Created
April 3, 2017 20:07
-
-
Save saabeilin/192444064fc7b28fce1e3af6b4ccf5a3 to your computer and use it in GitHub Desktop.
NGINX, logging in Logstash JSON
This file contains 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
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