Skip to content

Instantly share code, notes, and snippets.

@IngussNeilands
Forked from asiegman/nginx.conf
Created September 27, 2017 13:49
Show Gist options
  • Save IngussNeilands/73692ebcfe759b899b2175f456c018f6 to your computer and use it in GitHub Desktop.
Save IngussNeilands/73692ebcfe759b899b2175f456c018f6 to your computer and use it in GitHub Desktop.
nginx logstash output
# Output json-esque output for logstash to parse easily.
http {
# ...
log_format logstash_json '{"@timestamp": "$time_iso8601", '
'"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", '
'"http_referer": "$http_referer", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"http_x_real_ip": "$http_x_real_ip", '
'"upstream_response_time": "$upstream_response_time"'
'}';
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