nginx配置json格式日志

2022/6/26 5:22:57

本文主要是介绍nginx配置json格式日志,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

   log_format fat-s-k8s   '{"@timestamp":"$time_iso8601",'
                          '"@source":"$server_addr",'
                          '"app":"nginx",'
                          '"hostname":"$hostname",'
                          '"remote_user":"$remote_user",'
                          '"ip":"$http_x_forwarded_for",'
                          '"client":"$remote_addr",'
                          '"request_method":"$request_method",'
                          '"scheme":"$scheme",'
                          '"domain":"$server_name",'
                          '"referer":"$http_referer",'
                          '"request":"$request_uri",'
                          '"requesturl":"$request",'
                          '"args":"$args",'
                          '"size":$body_bytes_sent,'
                          '"status": $status,'
                          '"responsetime":$request_time,'
                          '"upstreamtime":"$upstream_response_time",'
                          '"upstreamaddr":"$upstream_addr",'
                          '"http_user_agent":"$http_user_agent",'
                          '"http_cookie":"$http_cookie",'
                          '"https":"$https"'
                          '}';

引用

access_log  /data/k8s-storage/logs/fat-s-k8s/nginx/nginx-kkcloud-k8s-commsumer.json fat-s-k8s;

 



这篇关于nginx配置json格式日志的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程