nginx - log_format

1992 단어

nginx - log_format
log_format
 
syntax: log_format name format [format ...]
default: log_format combined "..."
context: http server
Directive log_format describes the format of a log entry. Besides general variables in the format it is possible to use variables which exist only at the moment of record into the log:
  • $body_bytes_sent, the number of bytes, transmitted to client minus the response headers, variable is compatible with parameter %B of module Apache's mod_log_config (this was called $apache_bytes_sent, before version 0.3.10)
  • $bytes_sent, the number of bytes, transmitted to client
  • $connection, the number of connection
  • $msec, the time with an accuracy to microseconds at the moment of the log entry
  • $pipe, "p" if request was pipelining
  • $request_length, the length of the body of the request
  • $request_time, the time of working on request in seconds, since 0.5.19 in millisecond precision
  • $status, status of answer
  • $time_local, local time into common log format.
  • $http_x_forwarded_for, X-Forward infomation

  • The headers, transmitted to client, begin from the prefix "sent_http_", for example, $sent_http_content_range.
    Note that variables produced by other modules can also be logged. For example you can log upstream response headers with the prefix "upstream_http_", see upstream.
    In the configuration there is always a predetermined format "combined":
     
    log_format  combined  '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent"';

    [log format 문서]
    http://wiki.codemongers.com/NginxHttpLogModule#log_format
    [관련 질문]
    log_format

    좋은 웹페이지 즐겨찾기