I was cleaning up some code that I use to generate emails for alerts based on some criteria in Logstash.
These alerts send an email as well as create a new document for insertion into Elasticsearch. This gives a historial record of any alerts generated.
When I added some mutate lines to my Logstash config to remove the unused fields AFTER the email output but BEFORE the Elasticsearch output, the emails basically came across as blank.
All I am trying to do, is remove the extra fields before the log gets inserted into Elasticsearch. But it seems, that even though the remove fields config is AFTER the email output config everything breaks.
All filters are processed before the outputs. All outputs see the same events (but you can choose which outputs get which events). Two immediate options:
Store the email-only fields under the @metadata field (which isn't included in what's sent to ES).
Use a clone filter to splice each event in two. Then you can do whatever mutations you want and route the clone and the original event to different outputs.
So,
Part of what I do is, use a IF statement to check if certain fields have data. Based on the true/false outputs of those checks I build out a section of HTML based code.
When I tried to store that code as part of a metadata field, nothing came across in my email output.
So then I built regular fields to store the sections of code.
I don't want to use non-supported plugins, if at all possible. Clone wasn't on the list, the last time I looked.
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.