Reading data trough mongodb -input

I'm trying to learn more about the mongodb-input-plugin. I'm running a local mongo db instance on my localhost on my Win 10 machine. The database is up and used with other purposes. There is no security on the database - the database can be accessed on the standard monogdb port 27017.

My config file to start logstash looks like this:


input {
uri => "mongodb://mongodb_host:27017"
placeholder_db_dir => "/Program Files/MongoDB/Server/4.2"
placeholder_db_name => "Cases"
collection => "baby_names"
batch_size => 5000
}

filter {

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

I started the logstash process like this:

c:\Programme\Elastic\Logstash\logstash-7.10.1\bin>logstash -f baby_names_monogdb.conf -e
The console output that I get after starting the logstash process looks like this:


Using JAVA_HOME defined java: C:\Program Files\Java\jdk1.8.0_271
WARNING, using JAVA_HOME while Logstash distribution comes with a bundled JDK
Sending Logstash logs to c:/Programme/Elastic/Logstash/logstash-7.10.1/logs which is now configured via log4j2.properties
[2021-01-01T17:07:49,458][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.10.1", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc Java HotSpot(TM) 64-Bit Server VM 25.271-b09 on 1.8.0_271-b09 +indy +jit [mswin32-x86_64]"}
[2021-01-01T17:07:49,745][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-01-01T17:07:50,443][INFO ][logstash.config.source.local.configpathloader] No config files found in path {:path=>"c:/Programme/Elastic/Logstash/logstash-7.10.1/bin/baby_names_monogdb.conf"}
[2021-01-01T17:07:50,463][ERROR][logstash.config.sourceloader] No configuration found in the configured sources.
[2021-01-01T17:07:50,958][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2021-01-01T17:07:55,740][INFO ][logstash.runner          ] Logstash shut down.
[2021-01-01T17:07:55,759][ERROR][org.logstash.Logstash    ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit


I assume that the problem could be a wrong formatted connection string ore path in in the input section of the .conf files - I did not find any hints to solve this issue.

All hints and guidance is very welcome.

Kind regards
Alex

You are running logstash in the c:\Programme\Elastic\Logstash\logstash-7.10.1\bin directory and only giving a filename with -f, so logstash is looking in that directory for the configuration, but it does not exist there. You can use a relative path or an absolute path with -f to tell logstash where to look for the configuration file.

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