JDBC Input plugin doesn't forward username and password to MySQL


(Mor Paz) #1

I am trying to use the jdbc input plugin to get data from my MySQL DB to my Elasticsearch server, I have installed a mysql-connector-java-8.0.11-1.el7.noarch package and my Logstash is already running fine for other inputs (including beats and syslog).

Here is my input configruation:

input {
  jdbc {
    jdbc_connection_string => "jdbc:mysql://DB_IP:3306/KAS"
    jdbc_user => "user"
    jdbc_password => "password"
    jdbc_driver_library => "/usr/share/java/mysql-connector-java-8.0.11.jar"
    jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
    schedule => "* * * * *"
    statement => "SELECT * from alerts"
    type => "mysql"
  }
}

The driver is loaded correctly but the connection to the DB is never made, here is the error I see in the log files:

[2018-07-23T13:58:00,069][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLException: Access denied for user ''@'SOURCE_IP' (using password: NO)"}

It seems that the logstash input doesn't pickup the user and the password from my config file, but I can't understand why.


(Mor Paz) #2

I figured out the problem, apparently the jdbc input plugin wasn't updated. After using the logstash-plugin command to update the plugin it began working perfectly.


(system) closed #3

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