I did a quick training about Logstash on Udemy and I think i forgot about one important thing and didn't took a note. So I could use a brief explanation on what do I do wrong.
Based on the message content, I wanted to add a field called fingerprint, where value depends on whether message starts with <BATCH. My config looks like this:
So no new field is added. How should i fix that? Should I first add something to message filed in filter? The output contains field message, so I'm not sure whether this should be done in the first step. Appreciate the help!
One more question. If I'm trying to check whether a field contains specific word, I should use =~ "BATCH" (with quotes) but I want want to validate a regex like the one above, I should not use them?
=~ is used when you want to check with regular expression. == is used when you want to compare something like int, string etc. Strings definitely need quotes around them.
There is no implicit anchoring in a regep. So having a trailing .*$ in it makes no sense. If you care whether it starts with that you need to anchor it yourself.
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.