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

**URL:** <https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481>\
**Category:** Logstash\
**Created:** [October 19, 2020, 7:02am UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481 "2020-10-19T07:02:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksathya](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@ksathya](https://discuss.elastic.co/u/ksathya)\
**Post date:** [October 19, 2020, 7:02am UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/1 "2020-10-19T07:02:38Z")

</div>

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:

```auto
    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:

```auto
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

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

```

But nothing works.

Any idea what I am doing wrong?

TIA!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 19, 2020, 1:40pm UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/2 "2020-10-19T13:40:22Z")

</div>

> [@ksathya](#):
>
> `:backtrace=>["D:/logstash-7.9.0/vendor/bundle/jruby/2.5.0/gems/mongo-2.0.6/lib/mongo/uri.rb:213:`

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

The code that raises that exception is [here](https://github.com/mongodb/mongo-ruby-driver/blob/fca06ac530d74a30e6e1d3d1206370838f8d2d00/lib/mongo/uri.rb#L213), and the list of options that it supports comes just after that.

---

<div class="post-metadata">

**Author:** ![ksathya](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@ksathya](https://discuss.elastic.co/u/ksathya)\
**Post date:** [October 20, 2020, 6:20am UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/3 "2020-10-20T06:20:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 20, 2020, 2:36pm UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/4 "2020-10-20T14:36:56Z")

</div>

The mongodb output is not installed by default. The [documentation](https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html#updating-plugins) covers how to install and update plugins.

---

<div class="post-metadata">

**Author:** ![ksathya](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@ksathya](https://discuss.elastic.co/u/ksathya)\
**Post date:** [October 21, 2020, 5:01am UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/5 "2020-10-21T05:01:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 18, 2020, 5:01am UTC](https://discuss.elastic.co/t/ssl-options-not-working-in-logstash-output-mongodb-ls-v7-9-0/252481/6 "2020-11-18T05:01:41Z")

</div>

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