nginx访问日志格式配置

来源:互联网 发布:摩尔庄园 mac 破解 编辑:程序博客网 时间:2024/06/05 22:47

在现网环境中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';


0 0
原创粉丝点击