Logstash: Error jdbc_driver_library not loaded


(salma) #1

Hi,
I need to get data from a PostgreSQL DB and index it into Elasticsearch. When I run /opt/logstash-2.3.3/bin/logstash -f contacts-index-logstash.conf I receive the following error:

Could not find log4j2 configuration at path /elk/logstash/config/log4j2.properties. Using default config which logs to console
LoadError: no such file to load -- C:/elk/PostgreSQL/9.5/share/java/postgresql-9.4-1201.jre6
require at org/jruby/RubyKernel.java:1040
require at C:/elk/logstash/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65 load_drivers at C:/elk/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/plugin_mixins/jdbc.rb:134
each at org/jruby/RubyArray.java:1613
load_drivers at C:/elk/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/plugin_mixins/jdbc.rb:132
prepare_jdbc_connection at C:/elk/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/plugin_mixins/jdbc.rb:146
register at C:/elk/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/inputs/jdbc.rb:191
start_inputs at C:/elk/logstash/logstash-core/lib/logstash/pipeline.rb:353
each at org/jruby/RubyArray.java:1613
start_inputs at C:/elk/logstash/logstash-core/lib/logstash/pipeline.rb:352
start_workers at C:/elk/logstash/logstash-core/lib/logstash/pipeline.rb:228
run at C:/elk/logstash/logstash-core/lib/logstash/pipeline.rb:183
start_pipeline at C:/elk/logstash/logstash-core/lib/logstash/agent.rb:292


(Oleksii Mazilov) #3

Pls show your conf file


(salma) #4

hi ,

this is my conf file

file: contacts-index-logstash.conf

input {
jdbc {
jdbc_connection_string => "jdbc:postgresql://localhost:5432/mydb"
jdbc_user => "postgres"
jdbc_validate_connection => true
jdbc_driver_library => "/elk/postgresql-9.4-1212.jre6.jar"
jdbc_driver_class => "org.postgresql.Driver"
statement => "SELECT * from contacts"
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "contacts"
document_type => "contact"
document_id => "%{uid}"

}

}


(Oleksii Mazilov) #5

You need to specify full path to driver:
Example: jdbc_driver_library => "/usr/local/src/elk/postgresql-9.4-1212.jre6.jar"
Because in your case, JDBC plugin is trying to find driver in /elk folder in root


(system) #6

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