Connect to mongodb using logstash Jdbc_streaming filter plugin

I'm trying to fetch data from mongodb using Jdbc_streaming filter plugin in logstash in windows. I'm using mongo-java-driver-3.4.2.jar to connect to the database but, getting a error like this

JavaSql::SQLException: No suitable driver found for jdbc:mongo://localhost:27017/EmployeeDB

No any luck with existing references. I'm using logstash 7.8.0 version. This is my logstash config:

jdbc_streaming {
        jdbc_driver_library => "C:/Users/iTelaSoft-User/Downloads/logstash-7.8.0/mongo-java-driver-3.4.2.jar"
        jdbc_driver_class => "com.mongodb.MongoClient"
        jdbc_connection_string => "jdbc:mongo://localhost:27017/EmployeeDB"
        statement => "select * from Employee"
        target => "name"

How can I fix the above error?

Hi Rasitha,

Make sure that you are using right mongo driver. I have faced the same challenge in 7.7.0 with the mongo-java-driver-3.6.4.jar. But I resolved it by upgrading the JDBC driver. You can download jars from below link.

Hi Chandu,

Thanks for the reply. I did resolve the problem by doing below steps.

  1. download
  2. unzip and copy all the files to the path(~/logstash-7.8.0/logstash-core/lib/jars/)
  3. modify the .config file

Config file:

     jdbc_driver_library => "absolute_path_to_file\mongojdbc2.1.jar"
     jdbc_driver_class => "com.dbschema.MongoJdbcDriver"
     jdbc_connection_string => "jdbc:mongodb://localhost:27017/nmis"
     statement => "{ }, {'_id': false})"
     target => "test_details"

In the linux environment I had to remove 'jdbc_driver_library =>' property completely from the config and also keep one version of JDBC driver files to get it work.

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