Handle null values in json

I have a JSON line this
{ "name": "prem", "level": null }

My Logstash configuration looks like this

filter {
grok {
match => {{TIMESTAMP_ISO8601:timestamp} %{GREEDYDATA:logD}" }
}
json{
source => "logD"
target => "logMsg"

	add_field => {
      "nameField" => "%{[logMsg][name]}"
      "levelField" => "%{[logMsg][level]}"

}
remove_field => ["logD"]
}

}

When the above log was processed I am getting '%{[logMsg][level]}' value in levelField.
How to set 'levelField' to null.

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