首页 > Web开发 > 详细

nginx日志使用json输出

时间:2019-10-22 11:28:10      阅读:80      评论:0      收藏:0      [点我收藏+]
在nginx中使用json格式输出日志记录

log_format json ‘{ "time_local": "$time_local", ‘
‘"remote_addr": "$remote_addr", ‘
‘"referer": "$http_referer", ‘
‘"request": "$request", ‘
‘"status": $status, ‘
‘"bytes": $body_bytes_sent, ‘
‘"agent": "$http_user_agent", ‘
‘"x_forwarded": "$http_x_forwarded_for", ‘
‘"up_addr": "$upstream_addr",‘
‘"up_host": "$upstream_http_host",‘
‘"upstream_time": "$upstream_response_time",‘
‘"request_time": "$request_time"‘
‘ }‘;

access_log /var/log/nginx/access.log json;

对于使用filebeat来收集日志很重要。

nginx日志使用json输出

原文:https://blog.51cto.com/725689/2444370

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!