Many log files are stored on the system in various locations. I'm attempting to use filestream input type to read log files and then send them straight to Elasticsearch. "Error loading template: error creating template instance: key not found" is what I'm seeing when I try to create an index for every log path on Kibana. Whats wrong with the configuration?
Filebeat version is 8.14.3
This might be because the setup phase for the template is prior to events being processed. Since the filestream id appears to be equivalent to fields.custom-index you might try referring to that instead.
There's nothing wrong with the fields.custom_index reference. I think the problem is in the template setup command, and the availability of the key.
I believe the setup template command must run prior to the evaluation of any data. Does your data differ significantly in which you want to map the available fields differently? Do you really want to apply different templates?
If so, you may be able to refer to those templates statically and sequentially.
If not, you could create a pattern that applies to all indices, such as filestream-*
Thanks for the answer. I need to apply different templates. I couldnt find any example about referring templates statically. Can you please point me to an example?
Single index pattern works but, yeah, for every filestream input type an index should be created.
A different index can still be created with the output.elasticsearch index parameter. That should stay dynamic. I'm wondering if you need different templates for each index. The main reason to have different templates if you need to map the same field names to different types. But the managed templates Elastic provides do a lot of the heavy lifting for you, and your have setup.template.enabled: true
Unfortunately, I encountered another error. I apologize for misdirecting you. Custom fields are not necessary for input types. To utilize as dynamic index naming, I add them. In my situation, fields: custom-index: is entirely unnecessary. There were no examples of using the input type id value that I could locate. I simply need different index names for different log files with lifecycle policy ofcourse.
Exiting: error initializing publisher: unsupported format expression "yyyy.MM.dd" in index
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.