logstash-filter-mutate icon indicating copy to clipboard operation
logstash-filter-mutate copied to clipboard

Omitempty

Open gferreux opened this issue 5 years ago • 0 comments

Add an operation called 'omitempty' to remove fields with null or default values. (works with string "", integer 0, array [], hashes {}, and null values)

filter {
  mutate {
    omitempty => ["field"]
  }
}

will remove field if field = "", 0, [], {} or null

useful with the logstash-codec-protobuf to remove fields present in the proto definition that have no values, aka "omitempty"in the JSON marshaller options

(new to ruby and logstash filters dev, so please fell free to point any bad or misplaced statement, thanks)

gferreux avatar Mar 05 '19 10:03 gferreux