Dear, would you know how to write complex IF condition on Logstash? I would like to add new tag once two fields have different values, except of some combinations of them. What works:
if [event][code] == "1" and [processtemptemp] and [processpetemp] and "original_file_name_missing" not in [tags] {
if ( [processtemptemp] != "nltest.exe" and [processpetemp] != "nltestrk.exe" ) {
if [processtemptemp] != [processpetemp] {
mutate {
add_tag => [ "file_rename" ]
tag_on_failure => ["_add_tag_failure_file_rename"]
}
}
}
}
What does not work:
if [event][code] == "1" and [processtemptemp] and [processpetemp] and "original_file_name_missing" not in [tags] {
if (( [processtemptemp] != "nltest.exe" and [processpetemp] != "nltestrk.exe" ) or ( [processtemptemp] != "schtasks.exe" and [processpetemp] != "sctasks.exe" )) {
if [processtemptemp] != [processpetemp] {
mutate {
add_tag => [ "file_rename" ]
tag_on_failure => ["_add_tag_failure_file_rename"]
}
}
}
}
if "file_rename" in [tags] and [processtemptemp] in ["nltest.exe", "schtasks.exe", "microsoftedgeupdate.exe"] and [processpetemp] in ["nltestrk.exe","sctasks.exe","msedgeupdate.dll"] {
mutate {
remove_tag => [ "file_rename"]
}
}
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.