We am using Elastic Stack 7.2.0 . We have setup filebeat to ship data directly to elasticsearch but we have some application log files which requires special parsing. We are sending these logs from filebeat to logstash where we are using custom grok patterns to parse the custom fields.
We want to store this data from logstash in the same index that filebeat creates in elasticsearch . For this purpose we are specifying the template_name to be using in the logstash output filter .
The template_name specified exists with some special shard settings . We want these setting to be applied to the indices created by logstash and not the default shard settings.
$ curl -X GET http://hostname:9200/_cat/templates | grep filebeat
filebeat-7.2.0 [filebeat-7.2.0-*]
What is the correct way to use the template settings in logstash output elasticsearch plugin so that the existing filebeat-7.2.0 template is not overwritten and the template is applied to the new indexes created by logstash.
We tried to set the logstash output in the following way but logstash is over writing the template settings in filebeat-7.2.0. However , the indexes are created in the "index" format specified.
The template* parameters for the plugin are for creating/updating managed templates, not for influencing what template the index will use.
At index creation, all templates that have an index pattern matching the index name will be applied in template priority order. You can create a template with any name with an index pattern matching the desired index with only the shard settings, something like my "filebeat-default" template:
Is it possible to force logstash to set the template for the index it creates on elasticsearch or is the selection of template for an index is completely handled by elasticsearch.
We already set the order of the template to 1 so it takes precedence over all over templates . But if the selection of template is based on index patterns of the templates thenwe can set it order to -1 to guarantee that "filebeat-7.2.0" is picked up everything.
I have set the output with the template_name and it seems logstash is picking up the desired template .
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.