ChsHttpLogModule
- ngx_http_log_module
瀹炰緥
log_format gzip '$remote_addr - $remote_user [$time_local] ' : '"$request" $status $bytes_sent ' : '"$http_referer" "$http_user_agent" "$gzip_ratio"'; access_log /spool/logs/nginx-access.log gzip buffer=32k;
Contents |
鎸囦护
access_log
璇硶锛 access_log path [format [buffer=size | off ] 榛樿鍊硷細 access_log log/access.log combined
浣滅敤鍩燂細 http, server, location
鎸囦护 access_log 鎸囨淳璺緞銆佹牸寮忓拰缂撳瓨澶у皬銆傚弬鏁 "off" 灏嗘竻闄ゅ綋鍓嶇骇鍒殑鎵鏈 access_log 鎸囦护銆傚鏋滄湭鎸囧畾鏍煎紡锛屽垯浣跨敤棰勭疆鐨 "combined" 鏍煎紡銆傜紦瀛樹笉鑳藉ぇ浜庤兘鍐欏叆纾佺洏鐨勬枃浠剁殑鏈澶уぇ灏忋傚湪 FreeBSD 3.0-6.0 锛岀紦瀛樺ぇ灏忔棤姝ら檺鍒躲
log_format
璇硶锛 log_format name format [format ...]
榛樿鍊硷細 log_format combined "..."
浣滅敤鍩燂細 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
- $status, status of answer
- $time_local, local time into common log format.
The headers, transmitted to client, begin from the prefix "sent_http_", for example, $sent_http_content_range.
In the configuration there is always a predetermined format "combined":
log_format combined '$remote_addr - $remote_user [$time_local] ' : '"$request" $status $apache_bytes_sent ' : '"$http_referer" "$http_user_agent"';