调试用的
log_format json '{'
'"time_local":"$time_local",'
'"time_iso8601":"$time_iso8601",'
'"host":"$host",'
'"remote_addr":"$remote_addr",'
'"http_x_forwarded_for":"$http_x_forwarded_for",'
# $remote_user等同于用户名,由ngx_http_auth_basic_module认证
'"remote_user":"$remote_user",'
# 客户端port
'"remote_port":"$remote_port",'
'"request":"$request",'
# 含有参数的完整的初始URI
'"request_uri":"$request_uri",'
# $query_string与$args一样
'"args":"$args",'
'"query_string":"$query_string",'
'"status":"$status",'
# 协议,通常是“GET”或“POST”
'"request_method":"$request_method",'
'"server_protocol":"$server_protocol",'
'"request_body":"$request_body",'
# 当前请求的文件的路径名,由root或alias和URI request组合而成
'"request_filename":"$request_filename",'
'"body_bytes_sent":"$body_bytes_sent",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent",'
'"upstream_addr":"$upstream_addr",'
'"upstream_response_time":"$upstream_response_time",'
'"upstream_status":"$upstream_status",'
'"request_time":"$request_time",'
'"cookie_uid":"$cookie_uid"'
'}';
loghao 记录下来以后用
log_format loghao '[$time_local] - $remote_user $http_x_forwarded_for - $host$request_uri $status $request_method $server_protocol $body_bytes_sent '
'"$http_referer" "$request_body" "$http_user_agent" "$request_filename" '
'"$upstream_addr" "$upstream_response_time" "$upstream_status" $request_time';
相关文章:
http://www.hebinghua.com/linux/25.html