+
95
-

多台服务器的nginx日志如何进行实时分析?

请问多台服务器的nginx日志如何进行实时分析?

网友回复

+
15
-

可以使用Logstash结合redis flink等存储来进行分析 先将nginx的日志输出改成json格式的

http {
include mime.types;
default_type application/octet-stream;
log_format json '{"@timestamp":"$time_iso8601",'
'"host":"$server_addr",'
'"clientip":"$remote_addr",'
'"request":"$request",'
'"size":$body_bytes_sent,'
'"responsetime":$request_time,'
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",'
'"url":"$uri",'
'"referer":"$http_referer",'
'"agent":"$http_user_agent",'
'"status":"$status"}';
access_log /data/nginx/logs/access_json.log json;
server_names_hash...

点击查看剩余70%

我知道答案,我要回答