How to save only one data into mongodb by logstash-output-mongodb plugin?

Like this output configuration, just want to send id to mongodb

output {
  mongodb {
    uri => 'mongodb://localhost'
    database => "testDB"
    collection => 'testCollection'
    codec => line { format => "%{id}"}
  }
}

But after ran it, every data had been saved into mongodb include id.

With Redis, it can work:

output {
  redis {
    host => ["127.0.0.1:6379"]
    data_type => "list"
    key => "ID"
    codec => line { format => "%{id}"}
  }
}

How to do with mongo if don't set a filter to reach the same result?

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