If condition for null in json field

I'm using the JDBC filter to pull info from a SQL database. If the field is blank, it generates the below:

"example": [
        "contoso": ""

I've tried the below to remove the empty field, but it doesn't seem to work. What am I doing wrong here?

if [example][0][contoso] == "" {
    mutate {
      remove_field => [ "example" ]

Have you solved this?
Your logic for the empty value field is OK. What is possible that you get null instead "". In that case:

if [example][0][contoso] {
    mutate {remove_field => [ "example" ] }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.