Push mongodb data to elasticsearch using logstash

I tried to configure logstash-input-mongodb plugin to crawl mongodb data into elasticsearch, but getting following error message.

My Environment is -
ELK - 5.5
logstash-input-mongodb plugin - 0.4.1

[2017-08-16T14:58:40,178][INFO ][logstash.inputs.mongodb ] Registering MongoDB input
[2017-08-16T14:58:40,394][ERROR][logstash.pipeline ] Error registering plugin {:plugin=>"<LogStash::Inputs::MongoDB uri=>"mongodb://user:pass@10.0.0.6:27017/mydb", placeholder_db_dir=>"/opt/logstash-mongodb/", placeholder_db_name=>"logstash_sqlite.db", collection=>"Book", batch_size=>5000, id=>"cd40c9769818facba841658632f8e3751ee58adb-2", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_ee6cc73a-2f42-4339-93b3-9323b8e38751", enable_metric=>true, charset=>"UTF-8">, since_table=>"logstash_since", since_column=>"_id", since_type=>"id", parse_method=>"flatten", isodate=>false, retry_delay=>3, generateId=>false, unpack_mongo_id=>false, message=>"Default message...", interval=>1>", :error=>"undefined method []' for nil:NilClass"} [2017-08-16T14:58:41,414][ERROR][logstash.agent ] Pipeline aborted due to error {:exception=>#<NoMethodError: undefined method[]' for nil:NilClass>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:99:in init_placeholder'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:113:inget_placeholder'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:160:in update_watched_collections'", "org/jruby/RubyArray.java:1613:ineach'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:158:in update_watched_collections'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:182:inregister'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:281:in register_plugin'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:292:inregister_plugins'", "org/jruby/RubyArray.java:1613:in each'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:292:inregister_plugins'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:442:in start_inputs'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:336:instart_workers'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:226:in run'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:398:instart_pipeline'"]}

My logstash configuration file is -
input {
mongodb {
uri => 'mongodb://user:pass@10.0.0.6:27017/mydb'
placeholder_db_dir => '/opt/logstash-mongodb/'
placeholder_db_name => 'logstash_sqlite.db'
collection => 'Book'
batch_size => 5000
}
}

filter {
date {
match => [ "logdate", "ISO8601" ]
}
}

output {
elasticsearch {
hosts => "localhost:9200"
}
}

Thanking in advance.

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