Comparison of String with number fails

Hey,

I'm transferring multiple events into ES using LS. For every event, i'm creating a timeStamp according to a milliseconds field:

  date {
    match => [ "saveTime", "UNIX_MS" ]
  }

Many events succeed but every once in a while LS just stops and I see this error:

...
:message=>"Exception in filterworker", "exception"=>#<ArgumentError: comparison of String with 1413763200000 failed>
...

Why does it happen?

The full backtrace is:

"backtrace"=>["org/jruby/RubyComparable.java:168:in `<'", "org/jruby/RubyString.java:1874:in `<'", "(eval):164:in `cond_func_5'", "org/jruby/RubyArray.java:1613:in `each'", "(eval):162:in `cond_func_5'", "(eval):95:in `filter_func'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:219:in `filterworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:156:in `start_filters'"], :level=>:error, :file=>"logstash/pipeline.rb", :line=>"231", :method=>"filterworker"

So I guess it happens on flush.

Solved this by adding another filter:

  mutate {
    convert => { "saveTime" => "integer" }
  }
1 Like

Thanks! Rocked it. Appreciate the followup refaelos!