FILEBEAT+ELK日志收集平台搭建流程 (2)

# nginx需要配置的日志输出格式为json格式:代替logstashgrok过滤。

 

    log_format main '{"nx_localtime@timestamp":"$time_local",'

 

        '"nx_host":"$server_addr",'

 

        '"nx_client_ip":"$remote_addr",'

 

        '"nx_body_size":$body_bytes_sent,'

 

        '"nx_request_time":$request_time,'

 

        '"nx_scheme":"$scheme",'

 

        '"nx_http_host":"$host",'

 

        '"nx_request_method":"$request_method",'

 

        '"nx_uri":"$uri",'

 

        '"nx_status":"$status",'

 

        '"nx_referer":"$http_referer",'

 

        '"nx_agent":"$http_user_agent",'

 

        '"nx_upstream_host":"$upstream_addr",'

 

        '"nx_upstream_response_time":"$upstream_response_time",'

 

        '"nx_upstream_response_length":"$upstream_response_length",'

 

        '"nx_upstream_status":"$upstream_status",'

 

        '"nx_upstream_connect_time":"$upstream_connect_time"}';

 

    include vhost/*.conf;

 

}

 

 访问nginx,查看此时nginx-log中的输出:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwjxdz.html