I am trying to store in a MongoDB collection some JSON datalogs filtered by Logstash. Mongod instance and Logstash are running on Windows 8.1 in the same laptop and I also installed logstash-output-mongodb plugin.
My configuration file for logstash is here:
# Sample Logstash configuration for receiving
# file data and importing to mongoDB
input {
file {
id => "my_input_plugin_id"
path => ["C:/data/input/*.json"]
}
}
filter {
}
output {
stdout {
}
mongodb {
uri => "mongodb://127.0.0.1:27017/test"
database => "test"
collection => "resultsFromLogstash"
}
}
When I run Logstash I receive two warns:
C:\logstash-7.9.2>.\bin\logstash.bat -f .\config\syslog.conf
Sending Logstash logs to C:/logstash-7.9.2/logs which is now configured via log4j2.properties
[2020-10-05T12:57:22,787][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.9.2", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-039a89c94bcc Java HotSpot(TM) 64-Bit Server VM 25.261-b12 on 1.8.0_261-b12 +indy +jit [mswin32-x86_64]"}
[2020-10-05T12:57:23,131][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-10-05T12:57:25,866][INFO ][org.reflections.Reflections] Reflections took 36 ms to scan 1 urls, producing 22 keys and 45 values
[2020-10-05T12:57:39,774][WARN ][logstash.outputs.mongodb ][main] MONGODB | Failed to handshake with 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
[2020-10-05T12:57:39,798][WARN ][logstash.outputs.mongodb ][main] MONGODB | Error running ismaster on 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
[2020-10-05T12:57:40,624][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>500, "pipeline.sources"=>["C:/logstash-7.9.2/config/syslog.conf"], :thread=>"#<Thread:0x93192ab run>"}
[2020-10-05T12:57:41,906][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {"seconds"=>1.27}
[2020-10-05T12:57:42,780][INFO ][logstash.inputs.file ][main] No sincedb_path set, generating one based on the "path" setting {:sincedb_path=>"C:/logstash-7.9.2/data/plugins/inputs/file/.sincedb_4b1f12191afab8d266f039bc3ec0ad9c", :path=>["C:/data/input/*.json"]}
[2020-10-05T12:57:42,820][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"}
[2020-10-05T12:57:42,945][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2020-10-05T12:57:42,947][INFO ][filewatch.observingtail ][main][my_input_plugin_id] START, creating Discoverer, Watch with file and sincedb collections
[2020-10-05T12:57:43,554][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-10-05T12:57:49,944][WARN ][logstash.outputs.mongodb ][main] MONGODB | Failed to handshake with 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
[2020-10-05T12:57:49,948][WARN ][logstash.outputs.mongodb ][main] MONGODB | Error running ismaster on 127.0.0.1:27017: ArgumentError: wrong number of arguments (given 2, expected 1)
On mongod side:
2020-10-05T12:57:39.620+0200 I NETWORK [listener] connection accepted from 127.0.0.1:64554 #167 (2 connections now open)
2020-10-05T12:57:39.685+0200 I NETWORK [conn167] received client metadata from 127.0.0.1:64554 conn167: { driver: { name: "mongo-ruby-driver", version: "2.13.0" }, os: { type: "mswin", name: "mswin32", architecture: "x86_64" }, platform:"JRuby 9.2.13.0, like Ruby 2.5.7, java, JVM 1.8.0_261, java1.8" }
2020-10-05T12:57:41.851+0200 I NETWORK [conn167] end connection 127.0.0.1:64554 (1 connection now open)
2020-10-05T12:57:49.937+0200 I NETWORK [listener] connection accepted from 127.0.0.1:64563 #168 (2 connections now open)
2020-10-05T12:57:49.940+0200 I NETWORK [conn168] received client metadata from 127.0.0.1:64563 conn168: { driver: { name: "mongo-ruby-driver", version: "2.13.0" }, os: { type: "mswin", name: "mswin32", architecture: "x86_64" }, platform:"JRuby 9.2.13.0, like Ruby 2.5.7, java, JVM 1.8.0_261, java1.8" }
It seems like mongod accepts connection but something wrong happened during handshake. It says that there were 2 arguments instead of 1 expected but I don't know at which level it refers to.
Any help would be appreciated.
Thank you.