Logstash Comparing Field Values Using an If Statement not working


I am trying to compare two fields using the following method but it is not working. I have used it before using an older version of logstash and it worked but it is not working on logstash 7.9.2.

Logstash cannot be able to compare values in two different fields:

old_user = john
new_user = john

Will result in the creation of the field_change field even though the fields have the same value.

Below is the code:

    if [old_USER] != "%{new_USER}" {
          mutate {
              add_field => { "field_change" => "user" }

Why not use

if [old_USER] != [new_USER] {

This worked. Thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.