Logstash ruby filter condition error

whenever I added an if condition the code doesn't work on the null offerlist field

here is my filter

code => '
      if event.get("offerList") == "NULL"
        t = event.get("UCounter")
        t.each_index { |i|
            t[i]["BUNDLE"] = @dict[t[i]["UCounter_ID"]]
        event.set("UCounter", t)
       x = event.get("UCounter")
        x.each_index { |i|
            x[i]["DESCRIPTION"] = @dict[x[i]["UCounter_ID"]]
        event.set("UCounter", x)

Is the value of the offerList really a string with the characters NULL?

Rather, are you testing for a missing offerList field? If so, then try event.get("offerList").nil?.
nil? is a method available on all Ruby instances.

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