Logstash jdbc plugin - filter issue


(srinivas m) #1

I am using below filter to copy content in COLUMN1 into COLUMN2.
filter { mutate { add_field => { "COLUMN2" => "%{COLUMN1 }" } } }
But if any value in COLUMN1 is null then its copying the value as %{COLUMN1 } into COLUMN2
How to avoid it printing %{COLUMN1 } and print null


(Magnus B├Ąck) #2
filter { 
  if [COLUMN1] {
    mutate {
      add_field => {
        "COLUMN2" => "%{COLUMN1}" 
      }
    }
  }
}

Caveat: If COLUMN1 exists and is a boolean value that's false the conditional will incorrectly be false.

(This has nothing to do with the JDBC input plugin.)


(system) #3