Ruby: no implicit conversion of String into Integer

This is my code
First I am changing them to integer
then if they are nil assign them 0
and then do calculation.

mutate {
      convert => { "killo" => "integer" }
      convert => { "trace" => "integer" }
   }

if ![killo] {
  mutate {update => { "kilo" => 0 } }
   }
   if ![trace] {
  mutate {update => { "trace" => 0 } }
   }

ruby {
      code => "event.set('total',(event.get('kilo')*event.get('trace')))"
   }

and I get this error

"ruby - Ruby exception occurred: no implicit conversion of String into Integer"

What I am doing wrong?

You seem to have a mix of kilo and killo in the config. Is this on purpose?

Ohhh man. yes that was typo.

Cool. I reran after fixing that and it works. Thank you

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