码迷,mamicode.com
首页 > 其他好文 > 详细

nginx日志配置

时间:2019-08-03 12:41:49      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:request   info   ddr   response   server   _for   custom   upstream   format   

log_format access_log_json ‘{"@timestamp":"$time_iso8601",‘
                 #‘"http_x_forwarded_for":"$http_x_forwarded_for",‘
                 ‘"clientip":"$remote_addr",‘
                 ‘"host":"$server_addr",‘
                 ‘"upstreamhost":"$upstream_addr",‘
                 ‘"remote_user":"$remote_user",‘
                 ‘"status":"$status",‘
                 ‘"upstreamtime":"$upstream_response_time",‘
                 ‘"responsetime":"$request_time",‘
                 ‘"size":"$body_bytes_sent",‘
                 ‘"http_host":"$host",‘
                 ‘"url":"$uri",‘
                 ‘"request_method":"$request_method",‘
                 ‘"request_body":"$request_body",‘
                 ‘"Authorization":"$http_authorization",‘ #自定义header
                 ‘"custom_info": "$http_custom_info",‘ #自定义header
                 ‘"referer":"$http_referer",‘
                 ‘"agent":"$http_user_agent"}‘;
access_log  /var/log/nginx/access.log access_log_json;

如果配置了自定义字段,请在nginx.conf打开这个配置

#开启用户自定义header支持
underscores_in_headers on;

 

nginx日志配置

标签:request   info   ddr   response   server   _for   custom   upstream   format   

原文地址:https://www.cnblogs.com/imcati/p/11294233.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!