-
-
Save pplanel/96429d8f659cceae4a3eaeadc876c44c to your computer and use it in GitHub Desktop.
Log as much information as possible in nginx to json 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
http { | |
log_format json_combined escape=json | |
'{' | |
'"time_iso8601":"$time_iso8601", "remote_addr":"$remote_addr", "remote_user":"$remote_user", "request":"$request",' | |
'"status": "$status", "body_bytes_sent":"$body_bytes_sent", "request_time":"$request_time","http_host":"$http_host","host":"$host",' | |
'"args":"$args",' | |
'"connection":"$connection","content_length":"$content_length","content_type":"$content_type","uri":"$uri","request_filename":"$request_filename",' | |
'"http_referrer":"$http_referer", "http_user_agent":"$http_user_agent",' | |
'"upstream_connect_time": "$upstream_connect_time", "upstream_response_time":"$upstream_response_time"' | |
'}'; | |
access_log /var/log/nginx/access-legacy.log combined; | |
access_log /var/log/nginx/access.jsonl json_combined; | |
error_log /var/log/nginx/error.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment