view source
Logging to Logstash JSON Format in Nginx
Inspired by the logstash cookbook on logging to JSON-format in Apache, I made a similar nginx log_format to make nginx log to Logstash JSON-format as well. The configuration is quite similar to the Apache configuration, but nginx got more sensible variable names. The configuration below needs to be included within the http-context in nginx.