其实nginx access日志的格式不是一成不变的,是可以自定义的。
在nginx的nginx.conf配置文件找到:log_format 这里就是日志的格式
看一下和上述日志匹配的log格式设置:
#access日志格式配置,具体参数不再细说,上面都已经说过了,自己对应一下即可
log_format main '$remote_addr - $remote_user [$time_local] '
'fwf[$http_x_forwarded_for] tip[$http_true_client_ip] '
'$upstream_addr $upstream_response_time $request_time '
'$geoip_country_code '
'$http_host $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_accept_language" "$http_user_agent" ';
#配置access log日志的存储位置及文件,注意:access.log文件是可以按日期进行分割的,方便查看及处理
access_log /home/serversoft/nginx/log/access.log main;
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对易采站长站的支持。








