Change "null" to null value

Hello,
I have an application that sends through the rest API a Json to logstash and this is filtered and outputted to an Elasticsearch cluster. The json is nested, so I have flattened it using the "split" codec in logstash like the following:

mutate {
	  add_field => { "primary_nested" => "%{[primary][nested]}" }
}

It works well, but when the nested field is empty (null) the value given to a field will be the string: "%{[primary][nested]}" because it finds no value. Is there a way to filter it so that if the value comes as "null" it leaves it empty so that Elasticsearch can receive it as null?

regards,

Israel

Wrap it in this?

if [primary][nested] {
...
}

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