Created
June 15, 2022 23:36
-
-
Save abraithwaite/90055e2c702389fe34692091e9455184 to your computer and use it in GitHub Desktop.
nginx structured logging in JSON
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
http { | |
log_format json_combined escape=json | |
'{' | |
'"ts":"$time_iso8601",' | |
'"remote_addr":"$remote_addr",' | |
'"remote_user":"$remote_user",' | |
'"request_time":"$request_time",' | |
'"request":{' | |
'"http_referrer":"$http_referer",' | |
'"http_user_agent":"$http_user_agent",' | |
'"uri":"$uri",' | |
'"request_uri":"$request_uri",' | |
'"method":"$request_method",' | |
'"xfwd":"$proxy_add_x_forwarded_for"' | |
'},' | |
'"upstream":{' | |
'"addr": "$upstream_addr",' | |
'"bytes_received": "$upstream_bytes_received",' | |
'"bytes_sent": "$upstream_bytes_sent",' | |
'"response_time": "$upstream_response_time",' | |
'"response_length": "$upstream_response_length"' | |
'},' | |
'"response":{' | |
'"status": "$status",' | |
'"body_bytes_sent":"$body_bytes_sent"' | |
'}' | |
'}'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment