Error in Logstash Pipeline

I am getting this error when trying to run my Logstash pipeline. I would appreciate any help!! Thanks so much!

[2021-03-21T22:02:58,827][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-03-21T22:02:59,683][ERROR][logstash.agent           ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \\t\\r\\n], \"#\", \"{\" at line 2, column 13 (byte 21) after input {\n        uri ", :backtrace=>["/Users/caitlyn/Desktop/logstash-7.11.2/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:184:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:69:in `initialize'", "/Users/caitlyn/Desktop/logstash-7.11.2/logstash-core/lib/logstash/java_pipeline.rb:47:in `initialize'", "/Users/caitlyn/Desktop/logstash-7.11.2/logstash-core/lib/logstash/pipeline_action/create.rb:52:in `execute'", "/Users/caitlyn/Desktop/logstash-7.11.2/logstash-core/lib/logstash/agent.rb:371:in `block in converge_state'"]}
[2021-03-21T22:03:00,039][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2021-03-21T22:03:04,968][INFO ][logstash.runner          ] Logstash shut down.
[2021-03-21T22:03:04,988][FATAL][org.logstash.Logstash    ] Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
	at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.13.0.jar:?]
	at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.13.0.jar:?]
	at Users.caitlyn.desktop.logstash_minus_7_dot_11_dot_2.lib.bootstrap.environment.<main>(/Users/caitlyn/desktop/logstash-7.11.2/lib/bootstrap/environment.rb:89) ~[?:?]
input {
        uri => 'mongodb://username:password@152.3.22.155'
        placeholder_db_dir => '/Users/caitlyn/desktop/logstash-7.11.2/bin'
        placeholder_db_name => 'logstash_sqlite.db'
        collection => 'ml4p'
        batch_size => 5000
}
filter {

}
output {
        stdout {
                codec => rubydebug
        }
        elasticsearch {
                action => "index"
                index => "mongo_log_data"
                hosts => ["localhost:9200"]
        }
}

You need to tell logstash which input you are trying to configure. I would start with

input {
    mongodb {
        uri => 'mongodb://username:password@152.3.22.155'
        placeholder_db_dir => '/Users/caitlyn/desktop/logstash-7.11.2/bin'
        placeholder_db_name => 'logstash_sqlite.db'
        collection => 'ml4p'
        batch_size => 5000
    }
}

I do not think the mongodb input is installed by default so you will need to install it.

Thank you! That worked but now I am getting this error:

WARN -- : MONGODB | Failed to authenticate to 152.3.22.155:27017: Mongo::Auth::Unauthorized: User cait (mechanism: scram) is not authorized to access admin (auth source: admin, used mechanism: SCRAM-SHA-1, used server: 152.3.22.155:27017 (STANDALONE)): Authentication failed. (18: AuthenticationFailed)

Do you have to have insert privileges in MongoDB for it to work?

It needs to be able to .connect to the database and to .find entries. I do not know anything about the mongodb permissions model so I cannot say what privileges it needs.

Thank you for your help!

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