Last active
November 13, 2021 03:03
-
-
Save hzbd/9dd768087f65d6026e14642bcc859e37 to your computer and use it in GitHub Desktop.
Nginx logging json format(http(s)&stream)
This file contains 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
log_format json_http_combined escape=json | |
'{ "@timestamp":"$time_iso8601",' | |
'"server_name":"$server_name",' | |
'"status":$status,' | |
'"bytes_sent":$bytes_sent,' | |
'"body_bytes_sent":$body_bytes_sent,' | |
'"remote_addr":"$remote_addr",' | |
'"request_time":$request_time,' | |
'"request_id":"$request_id",' | |
'"request_length":$request_length,' | |
'"request_method":"$request_method",' | |
'"request_uri":"$request_uri", ' | |
'"request_path":"$uri", ' | |
'"request_param":"$query_string", ' | |
'"request_body":"$request_body", ' | |
'"server_addr":"$server_addr",' | |
'"server_port":$server_port,' | |
'"server_protocol":"$server_protocol",' | |
'"ssl_protocol":"$ssl_protocol",' | |
'"ssl_cipher":"$ssl_cipher",' | |
'"ssl_session_id":"$ssl_session_id",' | |
'"http_host":"$http_host",' | |
'"http_referrer":"$http_referer",' | |
'"http_user_agent":"$http_user_agent",' | |
'"http_cookie":"$http_cookie",' | |
'"http_x_forwarded_for:"$http_x_forwarded_for",' | |
'"upstream_addr":"$upstream_addr",' | |
'"upstream_response_time":$upstream_response_time,' | |
'"upstream_connect_time":$upstream_connect_time }'; | |
log_format json_stream_combined escape=json | |
'{ "@timestamp":"$time_iso8601",' | |
'"session_time":"$session_time",' | |
'"server_addr":"$server_addr",' | |
'"server_port":"$server_port",' | |
'"remote_addr":"$remote_addr",' | |
'"remote_port":"$remote_port",' | |
'"ssl_protocol":"$ssl_protocol",' | |
'"ssl_session_reused":"$ssl_session_reused",' | |
'"ssl_cipher":"$ssl_cipher",' | |
'"ssl_server_name":"$ssl_server_name",' | |
'"status":"$status",' | |
'"bytes_sent":"$bytes_sent",' | |
'"bytes_received":"$bytes_received"}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment