I'm using filebeat, my setup is pretty plain: I index nginx log files. Now I wan't to log just one more field ($http_host). Let's say I prefix every line with that:
I'd assume that I can configure nginx module to interprete log lines using a different pattern. I cannot find anything in the filebeat configuration hinting to that.
How do I add the host_name to my log entries?
Unfortunately, the nginx module of Filebeat does not support by default to add more patterns.
But to work around the issue you could install your own nginx pipeline on Elasticsearch.
The pipeline which is loaded to ES is located under module/nginx/acces/ingest/default.json. You could add one more pattern to the first grok processor of the pipeline to parse your messages correctly. After you add the extra pattern, you need to upload the pipeline to ES again using /filebeat setup --pipelines -modules=nginx.
Let me know if you need further help with that.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.