Reuse db connection,driverclass, for jdbc inputs in logstash

input {
    jdbc {
      jdbc_connection_string => "jdbc:oracle:thin:@***:1521/***"
   jdbc_user => "***"
   jdbc_password => "***"
   jdbc_validate_connection => true
   jdbc_driver_library => "/opt/logstash-5.5.0/ojdbc6.jar"
   jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        statement => "SELECT ID, Field1, Field2 from tableDb1"
    }
    jdbc {
       jdbc_connection_string => "jdbc:oracle:thin:@***:1521/***"
   jdbc_user => "***"
   jdbc_password => "***"
   jdbc_validate_connection => true
   jdbc_driver_library => "/opt/logstash-5.5.0/ojdbc6.jar"
   jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        statement => "SELECT ID, Field3, Field4 from tableDb2"
    }
}

output {
    elasticsearch {
        index => "myIndex"
        document_type => "myDocument"
        document_id => %{id}
        hosts => "localhost"
    }
}





'Here I want to reuse the jdbc connections besides writing every time for JDBC input '

Do you mean you want the two inputs to share a connection? That's not going to happen.

Yes,but excluding sql path and lastrun

I do not think it is a problem to have two inputs using the same endpoint. Have you tried it? Did you have problems?

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