This is an example configuration to have nginx output JSON logs to make it easier for Logstash processing. I was trying to get nginx > Filebeat > Logstash > ES working and it wasn't until I connected Filebeat directly to Elasticsearch that I saw the expected data. Google led me to
ingest-convert.sh and I realized
filebeat setup works for Filebeat > ES but not Filebeat > Logstash > ES. This is because Logstash does not use ingest pipelines by default. You have to enable them in the
elasticsearch output block.
Having nginx log JSON in the format required for Elasticsearch means there's very little processing (i.e.
grok) to be done in Logstash. nginx can only output JSON for access logs; the
error_log format cannot be changed.
Extra fields are output and not used by the Kibana dashboards. I included them in case they might be useful. Since they are not declared in the
filebeat setup, their default is "string" when yo