Failed to configure JDBC Input Plugin with MongoDB

Hello, I'm trying to set up logstash with JDBC to consume data from MongoDB without success.
I am testing with the java drivers for MongoDb (https://mongodb.github.io/mongo-java-driver/) in its different versions:

  • mongodb-driver-3.4.2.jar
  • mongo-java-driver-3.4. 2.jar
  • mongodb-driver-core-3.4.2.jar

And using the following configuration:

input {
  jdbc {
    jdbc_connection_string => "jdbc:mongo://xxx.xxx.xxx.xxx:27017/database"
    jdbc_user => "user"
    jdbc_password => "password"
    jdbc_driver_library => "/etc/logstash/mongodb-java-driver-3.4.2.jar"
    jdbc_driver_class => "com.mongodb.MongoClient"
    statement => "SELECT * FROM table"
    schedule => "*/30 * * * *"
    tags => "mongodb"
  }
}

output {
  if "mongodb" in [tags] {
    stdout{}
    elasticsearch {
      index => "mongodb-%{+YYYY.MM.dd}"
      document_id => "%{uuid}"
      hosts => "localhost:9200"
    }
  }
}

And the log shows:

Sequel::DatabaseConnectionError
Java::JavaSql::SQLException: No suitable driver found for jdbc:mongo://xxx.xxx.xxx.xxx:27017
[2017-07-31T22:59:00,272][WARN ][logstash.inputs.jdbc     ] Failed test_connection.
[2017-07-31T22:59:00,272][WARN ][logstash.inputs.jdbc     ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseConnect
ionError: Java::JavaSql::SQLException: No suitable driver found for jdbc:mongo://xxx.xxx.xxx.xxx:27017>}
[2017-07-31T22:59:00,272][WARN ][logstash.inputs.jdbc     ] Attempt reconnection.

What can be the error?

Same problem facing any outcome

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