小编mko*_*kop的帖子

Logstash com.mysql.jdbc.Driver未加载

我对jdbc_driver_library有问题。

ELK_VERSION = 6.4.2

而且我将Docker用于麋鹿。

当我跑步时:

/opt/logstash# bin/logstash -f /etc/logstash/conf.d/mysql.conf
Run Code Online (Sandbox Code Playgroud)

取得错误:

error: com.mysql.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Run Code Online (Sandbox Code Playgroud)

驱动路径:

root@xxxxxxx:/etc/logstash/conectors# ls
mysql-connector-java-8.0.12.jar 
root@xxxxxxxxxx:/etc/logstash/conectors#
Run Code Online (Sandbox Code Playgroud)

mysql.conf:

input {
  jdbc {
    jdbc_driver_library => "/etc/logstash/conectors/mysql-connector-java-8.0.12.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/mydb"
    jdbc_user => "demouser"
    jdbc_password => "demopassword"
    statement => "SELECT id,name,city from ads"
  }
}

output {
stdout { codec => rubydebug }

     elasticsearch {
        index => 'test'
        document_type => 'tes'
        document_id => '%{id}'
        hosts => …
Run Code Online (Sandbox Code Playgroud)

jdbc logstash logstash-configuration logstash-jdbc

6
推荐指数
1
解决办法
4343
查看次数