I am trying to find length of an array for a field using ruby filter. But, I'm getting below error even though nul case is handled. Please let me know if there is any error in the filter.
Thanks in advance
filter {
ruby {
code => "event['failedattemptcount'] = event['failedattempttimes'].length if event['failedattempttimes'] != 'nil'"
}
}
error:
Ruby exception occurred: undefined method `length' for nil:NilClass {:level=>:eror}
"tags" => [
[0] "_rubyexception"
]