Logstash config: check if boolean field exists -
using logstash 1.4.2, have field myfield
boolean value in json document.
to check if exists (don't care boolean value) used:
if[myfield] { ...exists... } else { ...doesn't exist... }
the results testing conditional statement are:
[myfield] not exist --> false [myfield] exists, true --> true [myfield] exists, false --> false //expected true because field exists
it checking boolean value, not existence.
how can check boolean field exists?
kind of lame doesn't work right out of box, can hack -- add together string representation of boolean, compare against string, , remove added field:
filter { mutate { add_field => { "test" => "%{boolean}" } } if [test] == 'true' or [test] == 'false' { // field nowadays , set right } else { // field isn't nowadays or set other true/false } mutate { remove_field => [ "test" ] } }
logstash
No comments:
Post a Comment