When output from logstash to mangodb, can I specify which fields wanted in output?

I config two destination in logstash output, one is Elasticsearch, the other is mongodb. I only want to out put several fields to mongodb, not all of them. How to config to achieve that? Thanks a lot.

You might be able to do it by specifying a format option on a codec, or by using pipeline to pipeline communication with a forked path pattern.

could you give me an example? codec json has no format option. Here is my config:

mongodb {
      id => "my_mongodb_plugin_id"
      collection => "xxxxx"
      database => "xxxxx"
      uri => "mongodb://xx.xx.xx.xx:27017"
      codec => "json"

If you need to use a json codec you would need to use a forked-path pattern to create a path that removes the fields that you do not want.

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