【发布时间】:2017-12-12 12:34:06
【问题描述】:
这是我的 nginx 日志格式:
$my_ip - - [12/Dec/2017:12:00:08 +0000] "GET / HTTP/1.1" 200 64972 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7"
我使用的是 Ubuntu 14.04.3 LTS 和 nginx 版本:nginx/1.4.6 (Ubuntu)。
我已经在我的 nginx 配置中添加了这个:
log_format le_json '{"time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"status": "$status", '
'"request": "$request", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent"}';
access_log /var/log/nginx/access.log le_json;
参考链接:https://blog.rapid7.com/2014/08/12/json-logging-in-apache-and-nginx-with-logentries/
我需要将这些日志解析为json格式的logstash。
添加重新启动的 nginx 但没有任何改变。相同的日志格式,有人可以帮忙吗?
【问题讨论】:
-
在您的问题中,您在哪里使用标记的 loggly 服务?这里似乎无关。
-
已删除。谢谢
标签: json nginx logging logstash access-log