Skip to content

Instantly share code, notes, and snippets.

@saabeilin
Created April 3, 2017 20:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saabeilin/192444064fc7b28fce1e3af6b4ccf5a3 to your computer and use it in GitHub Desktop.
Save saabeilin/192444064fc7b28fce1e3af6b4ccf5a3 to your computer and use it in GitHub Desktop.
NGINX, logging in Logstash JSON
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"@version": 1, '
'"message": "$request $status $body_bytes_sent", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"status": "$status", '
'"request": "$request", '
'"request_method": "$request_method", '
'"server_protocol": "$server_protocol", '
'"http_referrer": "$http_referer", '
'"user_agent": "$http_user_agent" }';
access_log /var/log/nginx/access.log logstash_json;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment