Logstash Elasticsearch output - one field only


Is it possible to send only the "message" field to elasticsearch from logstash?

I have tried codec => line { format => "%{message}" } but the full beat output is still sent.


If you are using an elasticsearch output then I do not think you can change the output format. The logstash output knows that elasticsearch expects JSON, so it ignores the codec option that is shared by all outputs.

You may be able to use a prune output with a whitelist_names option so that only the [message] field is sent.

Thanks @Badger

I'll try the prune filter.

Also use [@metadata] fields, and remove_field which you don't need.

Thanks @Rios, will do.

Logstash and Elastic apps are flexible, whatever is easier, use it.

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