您的位置:首页 > 运维架构 > Nginx

nginx访问日志格式配置

2017-03-08 16:33 369 查看
在现网环境中nginx的访问日志对于故障定位(接口超时、网络异常)以及统计分析都十分有用,推荐使用以下log_format格式:

log_format  main  '$remote_addr-$remote_user [$time_local][$status][$host] "$request"  "$request_body"'
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';


log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$gzip_ratio" $request_time $bytes_sent $request_length';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: