2022-06-27

How to compare float in logstash?

It's the pipeline config for test:

input {
  file {
    path => "/tmp/test1.log"
  }
}
filter {
  json {
    source => "message"
  }
}

output {
  if [a] == 1.1 {
    stdout {}
  }
}

I echo some test log to logfile:

echo '{"a": 1.1,"b": "test"}' >> /tmp/test1.log

But there isn't any output in console, and I try use the condition if [a] == "1.1" either not work.

Somebody know how to compare float?

thanks!



No comments:

Post a Comment