Cannot load mongodb output plugin


I'm trying to use the mongodb output plugin.

The machine hosts Ubuntu 18.04, and logstash 6.5.4-1 is installed with apt. logstash then runs under the logstash user via systemd.

The plugin is installed with

/usr/share/logstash/bin$ sudo /usr/share/logstash/bin/logstash-plugin install logstash-output-mongodb
Validating logstash-output-mongodb
Installing logstash-output-mongodb
Installation successful

And a query shows that it has indeed been installed (v3.1.5):

/usr/share/logstash/bin$ sudo /usr/share/logstash/bin/logstash-plugin list | grep mongodb

However, I get an error that it cannot load a mongo file. See the error below. It seems to be a JRuby error. How do I fix this?

[2019-04-03T09:53:10,650][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:tealium, :exception=>"LogStash::PluginLoadingError", :message=>"Couldn't find any output plugin named 'mongodb'. Are you sure this is correct? Trying to load the mongodb output plugin resulted in this error: no such file to load -- mongo", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/plugins/registry.rb:211:in `lookup_pipeline_plugin'", "/usr/share/logstash/logstash-core/lib/logstash/plugin.rb:137:in `lookup'", "org/logstash/plugins/ `plugin'", "org/logstash/plugins/ `plugin'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:71:in `plugin'", "(eval):13:in `'", "org/jruby/ `eval'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:49:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:90:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:42:in `block in execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:92:in `block in exclusive'", "org/jruby/ext/thread/ `synchronize'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:92:in `exclusive'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:38:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:317:in `block in converge_state'"]}

I've tried to install everything with sudo -u logstash [...] logstash-plugin [...], but that's to no avail, as it does not change the error message.

For completeness here's the output part of my config:

output {
mongodb {
collection => "[...]"
database => "[...]"
uri => "mongodb://[..]"

I've tried to manually install the gem:

/usr/share/logstash$ sudo -u logstash bin/ruby -S gem list | grep mongo
logstash-output-mongodb (3.1.5)
mongo (2.8.0, 2.0.6)

And add these paths to my /etc/default/logstash:


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