nino
(nino)
September 16, 2020, 12:40pm
1
Hello all,
i have this float field:
{
"field_value" => 0.0
}
And this if statement in a logstash pipeline:
if [field_value] == 0 {
mutate{
add_field => {"is_zero" => "yes"}
}
}
else {
mutate{
add_field => {"is_zero" => "no"}
}
}
"is_zero" is always "no" in spite of "field_value" is 0.0. Sure i am missing something but i can't guess it
vvwood
(Vince Wood)
September 16, 2020, 12:46pm
2
As far as I know, 0 and 0.0 are not the same. (Float vs Int) What happens if you change the if statement to look for 0.0?
nino
(nino)
September 16, 2020, 1:03pm
3
Oh my god, i am stupid!. Thank you Vince
vvwood
(Vince Wood)
September 16, 2020, 1:24pm
4
You are most likely not stupid, but rather got lost in the details. It happens to the best of us. Glad I could help.
1 Like
system
(system)
Closed
October 14, 2020, 1:24pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.