-
-
Save ssh60/2b69408b86a86c2f713f58aac5a0fc59 to your computer and use it in GitHub Desktop.
Complete JSON nginx log_format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # json-log.conf - log all useful nginx variables in json formatted log | |
| # for details about these variables, see http://nginx.org/en/docs/http/ngx_http_core_module.html#variables | |
| log_format json-log '{' | |
| # $arg_* | |
| # $args | |
| # $binary_remote_addr | |
| '"body_bytes_sent":"$body_bytes_sent",' | |
| '"bytes_sent":"$bytes_sent",' | |
| '"connection":"$connection",' | |
| # $connection_requests | |
| # $content_length | |
| # $content_type | |
| # $cookie_* | |
| # $document_root | |
| # $document_uri | |
| '"host":"$host",' | |
| '"hostname":"$hostname",' | |
| '"http_cookie":"$http_cookie"' | |
| '"http_dnt":"$http_dnt",' | |
| '"http_referer":"$http_referer",' | |
| '"http_user_agent":"$http_user_agent",' | |
| '"http_x_forwarded_for":"$http_x_forwarded_for",' | |
| # $http_* | |
| # $https | |
| # $is_args | |
| # $limit_rate | |
| '"msec":"$msec",' | |
| # $nginx_version | |
| # $pid | |
| # $pipe | |
| # $proxy_protocol_addr | |
| '"query_string":"$query_string",' | |
| # $realpath_root | |
| '"remote_addr":"$remote_addr",' | |
| # $remote_port | |
| # $remote_user | |
| '"request":"$request",' | |
| # $request_body | |
| # $request_body_file | |
| # $request_completion | |
| # $request_filename | |
| # $request_length | |
| '"request_method":"$request_method",' | |
| '"request_time":"$request_time",' | |
| # $request_uri | |
| # $scheme | |
| # $sent_http_* | |
| # $server_addr | |
| '"server_name":"$server_name",' | |
| '"server_port":"$server_port",' | |
| '"server_protocol":"$server_protocol",' | |
| '"status":"$status",' | |
| # $tcpinfo_rtt | |
| # $tcpinfo_rttvar | |
| # $tcpinfo_snd_cwnd | |
| # $tcpinfo_rcv_space | |
| '"time_iso8601":"$time_iso8601",' | |
| '"time_local":"$time_local",' | |
| '"uri":"$uri",' | |
| '}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment