I am attempting to use the MongoDB Logstash Output plugin to output some data to the online MongoDB 3.4 (Atlas). Every time Logstash tries to send the data to the MongoDB I receive the following error:
[2017-11-24T22:24:55,885][WARN ][logstash.outputs.mongodb ] Failed to send event to MongoDB {:event=>#LogStash::Event:0x2141406e, :exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0xbc3fb62 @tag_sets=, @server_selection_timeout=30, @options={:database=>"test", :ssl=>true, :replica_set=>"staging-shard-0", :auth=>{:source=>"admin"}, :user=>"user", :password=>"password"}>>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.0.6/lib/mongo/server_selector/selectable.rb:99:in `select_server'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.0.6/lib/mongo/cluster.rb:122:in `next_primary'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.0.6/lib/mongo/collection.rb:196:in `insert_many'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.0.6/lib/mongo/collection.rb:175:in `insert_one'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-mongodb-3.1.3/lib/logstash/outputs/mongodb.rb:100:in `receive'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:92:in `block in multi_receive'", "org/jruby/RubyArray.java:1734:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/outputs/base.rb:92:in `multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator_strategies/legacy.rb:22:in `multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator.rb:49:in `multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:538:in `block in output_batch'", "org/jruby/RubyHash.java:1343:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:536:in `output_batch'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:481:in `worker_loop'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:439:in `block in start_workers'"]}
After doing some research it appears to be the MongoDB driver that is associated with the plugin. It is currently using 2.0.x and according to MongoDB's documentation the driver needs to be 2.4. I was wondering if anyone could assist in figuring how to connect Logstash to MongoDB as I am new to MongoDB. Below is the versions of software that I am working with.
Version of Software
MongoDB: 3.4
Logstash: 6.0
Plugin: 3.1.3
Thank you in advance.