I am processing kafka events and sending them to ES. I tag events so that I can tell which kafka topic they were from. I then use the tag in the output to direct events from different kafka topics to different ES indexes.
However, beyond their use in Logstash, I do not wish to send the tags to ElasticSearch and have to see them in Kibana. Is there any way to use the tags in logstash but prevent them from being sent to ES?
Use @metadata.tags instead of tags. @metadata fields are not forwarded by outputs, including the elasticsearch output. Your pipelines will need to use add_field instead of add_tag to populate this field. Or you can use add_tag and as the last step before your outputs rename tags to @metadata.tags. This will allow you to use @metadata.tags in your outputs to specify index names, but the field itself won't be sent.
Use an elasticsearch ingest pipeline to strip the tags field out of the incoming data before it is indexed.
@rcowart Using @metadata worked. Thank you both very much for the suggestions.
Regarding "elasticsearch ingest pipeline to strip the tags field out of the incoming data before it is indexed." are you referring to making a mapping or a dynamic mapping template for that field in that index such that "index": false? Would that be equivalent to stripping that field from the incoming data? Or does it mean that the field is still there but not "indexed" (meaning I can't search by it, but it is still there if I search by other fields?)?
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.