Jul 17, 2016

Logstash Config: Check if a field exists or not

There are times when we want to check if a field exists or not before performing an action.

To check if a field named field_1 exists

if [field_1] {
    mutate {}
    do something else
}


To check if a field named field_1 does not exist

if ![field_1] {
    mutate {}
    do something else
}

No comments:

Post a Comment