1
votes

I am trying to use ElasticSearch as docker container and to use Log Stash in different container. I am trying to add jdbc jar file to my docker container using a trick I've seen in youtube video. The logstash directory contains the conf file and the jdbc Jar file.

(The ES container named elasticsearch)

The command I am using -

docker run -h logstash --name logstash --link elasticsearch:elasticsearch -it --rm -v "$PWD":/config-dir logstash:7.3.2 -f /config-dir/logstash.conf

in my conf file I have tried to change the "jdbc_driver_library" to

"/config-dir/connector.jar"

"./config-dir/connector.jar"

"connector.jar"

""

But non of them seems to work, I am keep getting the following error:

LogStash::ConfigurationError 2052
Java::net.sourceforge.jtds.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library? 2052
/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' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:in
execute_statement' 2052
/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' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:258:in
block in run' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:234:in do_call' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:258:in
do_trigger' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:300:in block in start_work_thread' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:299:in
block in start_work_thread' 2052
org/jruby/RubyKernel.java:1425:in loop' 2052
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:289:in
block in start_work_thread'

** Following similar question I had tried to use uppercase J in Java, while defining jdbc_driver_class. unfortunately it didn't help.

1

1 Answers

1
votes

I've run into the same problem, with the SQL Server driver:

Error: com.microsoft.sqlserver.jdbc.SQLServerDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?

The solution was to copy the jar file to logstash-core/lib/jars folder.

Now you can remove the path to the library:

jdbc_driver_library = ""