You need to have quotes around your grok pattern, and the numeric comparison can crash things if those fields do not exist, so you should test for that using
if [TotalMRC] and [NMrc] {
if [TotalMRC] > [NMrc] {
The Quotes around Grok - I just missed that while copy pasting here.
However, added the null check as you recommended. Its not crashing now. Which is good thing. But Still don't see the field getting created, no errors in logs. Anything else I am missing?
match => {"message" => "Automation Type : %{DATA:AutomationTypeValue},ExistingTotalMrc : %{NUMBER:ExistingTotalMRC:float}, NewTotalMrc : %{NUMBER:NewTotalMRC:float}, %{GREEDYDATA:Greedymessage}"}
if [ExistingTotalMRC] and [NewTotalMrc] {
if [NewTotalMrc] > [ExistingTotalMRC] {
mutate {
add_field => {"SaleTrend" => "Upsell"}
}
}
}
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.