SSL options not working in logstash-output-mongodb (LS v7.9.0)

I am using logstash v7.9.0 for Windows. I am using logstash-output-mongodb plugin v 3.1.5.

My output code is as below:

    mongodb {     
            collection => "TestColection"
            database => "TestDB"         
            codec=> "json"
            uri => "mongodb://myusername:mypassword$@001.01.02.03:27017/TestDB?authSource=TestDB&ssl=true&sslallowinvalidcertificate=true"
    }

This is throwing below error:

Pipeline terminated by worker error {:pipeline_id=>"main", :exception=>#<Mongo::Error::InvalidURIOption: Invalid option in URI: 'sslallowinvalidcertificate'.
Please see the following URL for more information: http://docs.mongodb.org/manual/reference/connection-string/
>, :backtrace=>["D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/uri.rb:213:in `block in options'", "org/jruby/RubyArray.java:1809:in `each'", "org/jruby/RubyEnumerable.java:1126:in `inject'", "D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/uri.rb:210:in `options'", "D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/uri.rb:153:in `client_options'", "D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/client.rb:267:in `create_from_uri'", "D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/client.rb:150:in `initialize'", "D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/logstash-output-mongodb-3.1.5/lib/logstash/outputs/mongodb.rb:79:in `register'", "org/logstash/config/ir/compiler/OutputStrategyExt.java:126:in `register'", "org/logstash/config/ir/compiler/AbstractOutputDelegatorExt.java:68:in `register'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:226:in `block in register_plugins'", "org/jruby/RubyArray.java:1809:in `each'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:225:in `register_plugins'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:545:in `maybe_setup_out_plugins'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:238:in `start_workers'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:183:in `run'", "D:/logstash-7.9.0/logstash-core/lib/logstash/java_pipeline.rb:134:in `block in start'"], "pipeline.sources"=>["D:/logstash-7.9.0/work/PractitionerRoleNEW.conf"], :thread=>"#<Thread:0x2305c716 run>"}

I have also tried other options as provided in MongoDB portal

uri => "mongodb://${MongoDBUsername}:${MongoDBPassword}@serverhost:${MongoDBPort}/${MongoDBName}?authSource=${MongoDBName}&tlsAllowInvalidHostnames=true&tlsInsecure=true

But nothing works.

Any idea what I am doing wrong?

TIA!

That appears to be version 2.0.6, which is from 2015.

The code that raises that exception is here, and the list of options that it supports comes just after that.

Hi @Badger yes you are right, I happened to see the code after I raised this.. The set of SSL options are not much in mongo-2.0.6 library.. I also saw that the uri.rb in latest mongo-ruby-driver library has all SSL/TLS options.. Would like to know how to update the existing mongo gem to latest (and also it's dependencies)..Thanks

The mongodb output is not installed by default. The documentation covers how to install and update plugins.

I have already installed logstash-output-mongo plugin.. I have ver 3.1.5.. (I had some write issues when using ver 3.1.6, so reverted to 3.1.5).. So, it is possible to update mongo-2.0.6 gem library alone, while not updating logsatsh-output-mongo plugin?

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