Skip to content

Instantly share code, notes, and snippets.

@gnilchee
Created September 9, 2018 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnilchee/242f93bebb21d69f21c79b1cebb01b6f to your computer and use it in GitHub Desktop.
Save gnilchee/242f93bebb21d69f21c79b1cebb01b6f to your computer and use it in GitHub Desktop.
example nginx.conf with json logging (nginx 1.11.8+)
log_format json_combined escape=json
'{'
'"time_local":"$time_local", '
'"remote_addr":"$remote_addr", '
'"client_addr":"$proxy_add_x_forwarded_for", '
'"request_type": "$request_method", '
'"request":"$request", '
'"request_uri": "$uri", '
'"query_string": "$query_string", '
'"status": "$status", '
'"geoip_city": "$geoip_city", '
'"geoip_lat": "$geoip_latitude", '
'"geoip_long": "$geoip_longitude", '
'"body_bytes_sent":"$body_bytes_sent", '
'"total_bytes_sent": "$bytes_sent", '
'"request_time":"$request_time", '
'"http_referrer":"$http_referer", '
'"http_user_agent":"$http_user_agent"'
'}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment