I am trying to check if a field exists within a pair in an array inside of a larger object. I've tried to just add the field as is to make sure i was using the proper syntax and it works. I've done
mutate {
add_field => ["fieldname","%{[objectName][arrayName][#][fieldName]}"]
}
This creates the new field while adding the proper field. However, when I attempt to check the if the field exists I either get nothing or I get an error about the syntax.
if ! [%{[objectName][arrayName][#][fieldName]}] {
add_field => ["fieldname","%{[objectName][arrayName][#][fieldName]}"]
}
else {
add_field => ["fieldname",""]
}
For the if ! I've also changed the field to:
- %{[objectName][arrayName][#][fieldName]} : Gives syntax error
- "%{[objectName][arrayName][#][fieldName]}" : Gives syntax error
- [objectName][arrayName][#][fieldName] : gives nothing when there is and at others returns [objectName][arrayName][#][fieldName]