Logstash: Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?


(Pravin Dwiwedi) #1

Hi,

I am getting below error while using Mongodb Java Driver to ready data from MongoDB and push it to ES-
Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?

Plateform
OS- RHEL 6.6
Logstash- 5.5.0
Mongodb- 3.2.13
Jars- mongodb-driver-core-3.4.2, mongo-java-driver-3.4.2, bson-3.4.2

Logstash config
input{
jdbc{
jdbc_driver_library => "/home/pdwiwe/logstash-5.5.0/bin/mongo-java-driver-3.4.2.jar"
jdbc_driver_class => "mongodb.jdbc.MongoDriver"
jdbc_connection_string => "jdbc:mongo://hostname:27017?authSource=admin"
jdbc_user => "user"
jdbc_password => "pwd"
statement => "select * from system.users"
}
}
output {
if "_grokparsefailure" not in [tags]{
elasticsearch {
hosts => [ "localhost:9200" ]
index => "mongodb-data"
}
}
}

Start Logstash
/home/pdwiwe/logstash-5.5.0/bin$ sh logstash -f mongo.conf

Please help me where I am wrong....


I have the same problem
(João Duarte) #2

can you show me the error you're seeing? did you download the .jar and place it in /home/pdwiwe/logstash-5.5.0/bin/?


(Pravin Dwiwedi) #3

Thanks jsvd...

yes, below .jar are there.

All the jars are downloaded from - https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-core/3.4.2

  • mongodb-driver-core-3.4.2.jar
  • mongo-java-driver-3.4.2.jar
  • bson-3.4.2.jar

Below is the full error log--
-sh-4.1$ sh logstash -f mongo.conf
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Sending Logstash's logs to /home/pdwiwe/logstash-5.5.0/logs which is now configured via log4j2.properties
[2017-07-21T20:24:28,234][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://localhost:9200/]}}
[2017-07-21T20:24:28,268][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:9200/, :path=>"/"}
[2017-07-21T20:24:28,639][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>#Java::JavaNet::URI:0x197bbe26}
[2017-07-21T20:24:28,641][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2017-07-21T20:24:28,759][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-", "version"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"default"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "include_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2017-07-21T20:24:28,789][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>[#Java::JavaNet::URI:0x7c32be81]}
[2017-07-21T20:24:28,796][INFO ][logstash.pipeline ] Starting pipeline {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>500}
[2017-07-21T20:24:29,146][INFO ][logstash.pipeline ] Pipeline main started
[2017-07-21T20:24:29,306][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2017-07-21T20:24:29,638][ERROR][logstash.pipeline ] A plugin had an unrecoverable error. Will restart this plugin.
Plugin: <LogStash::Inputs::Jdbc jdbc_driver_library=>"mongodb-driver-core-3.4.2.jar", jdbc_driver_class=>"mongodb.jdbc.MongoDriver", jdbc_connection_string=>"jdbc:mongo://host:27017?authSource=admin", jdbc_user=>"admin", jdbc_password=>, statement=>"select * from system.users", id=>"3dc5c2b10eba8dfb0703222b3b3ae5ed228b8636-1", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_e4f395aa-de63-4157-9ffa-063833d3955e", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1970-01-01 00:00:00 UTC}, last_run_metadata_path=>"/home/pdwiwe/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?


(Pravin Dwiwedi) #4

any Help!


(system) #5

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