Mysql input is showing error

i want to fetch data from MySQL, below is the config file

input {
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://x.x.x.x:3306/xxx"
jdbc_user => "xxx"
statement => "SELECT * from xxx"
}
}

output{
elasticsearch { hosts => ["localhost:9200"]
index => "orders"
}
}

on running this config file below error is coming

[2019-07-22T10:12:28,324][ERROR][logstash.javapipeline ] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"xxx", statement=>"SELECT * from xxx", jdbc_driver_library=>"mysql-connector-java-5.1.36-bin.jar", jdbc_connection_string=>"jdbc:mysql://xxx:3306/xxx", id=>"2e0c46047eb17e2480245116ac5ec1305ab79e36e8f98e32cc92dc464d648422", jdbc_driver_class=>"com.mysql.jdbc.Driver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_bf3ee759-0641-40a0-90ef-7c7b2b7dbefc", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1970-01-01 00:00:00 UTC}, last_run_metadata_path=>"/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: com.mysql.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Exception: LogStash::ConfigurationError
Stack: /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:163:in open_jdbc_connection' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:inexecute_statement'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:277:in execute_query' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:263:inrun'
/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:297:in inputworker' /usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:290:inblock in start_input'

please help me in understanding what is the reason and how to resolve this?

Thanks in advance

I think you are missing the full path for jdbc_driver_library

jdbc_driver_library=/path/to/mysql-connector-java-5.1.36-bin.jar

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