Ruby exception occurred: undefined method `*' for nil:NilClass


(Jiyu3268891) #1

filter {

grok {
match => ["message", "%{TIMESTAMP_ISO8601:a} %{WORD} %{USER}] %{WORD} %{WORD} %{WORD:keyvalue}"]
add_tag => "warn"
}
metrics
{
meter => "events.%{keyvalue}"
add_tag => "metric"
ignore_older_than => 10
}
if "metric" in [tags] {
ruby {
        code => "event.cancel if event.get('events.all.rate_1m') * 60 < 5"
    }
}

}

The error is
[2017-05-04T03:13:32,431][ERROR][logstash.filters.ruby ] Ruby exception occurred: undefined method `*' for nil:NilClass
I don't know where is not correct.


Ruby filter: Ruby exception occurred: undefined method `*' for nil:NilClass
(Magnus Bäck) #2

Subfields are referenced via [field][subfield], not field.subfield, so you need to adjust your event.get call.


(Jiyu3268891) #3

Thank you, I have changed by code => "event.cancel if event['events.all']['rate_1m'] * 60 < 5"


(system) #4

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