1

I have a simple logstash configuration:

input {
      jdbc {
      jdbc_driver_library => "..\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
      jdbc_connection_string => "jdbc:sqlserver:/server:1433;databaseName=DBNAME;integratedSecurity=true;"
      jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
      statement => "select top(10) eventdata from TABLE"       
        schedule => "*/20 * * * * *"
           }
    }

    output {
        jdbc {
            connection_string  => "jdbc:sqlserver://DBSERVER:1433;databaseName=DBNAME;integratedSecurity=true;"
            driver_jar_path  =>"..\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
            statement => ["insert into TABLENAME(t) values(?)", "@timestamp"]
      }  
    }

The input part works fine reading values from the db. However, when it tries to output into another database, I receive the following error:

 Java::JavaLang::IllegalAccessError: com/microsoft/sqlserver/jdbc/StreamError
  2076       com.microsoft.sqlserver.jdbc.TDSTokenHandler.onError(com/microsoft/sqlserver/jdbc/tdsparser.java:222)
  2076       com.microsoft.sqlserver.jdbc.TDSParser.parse(com/microsoft/sqlserver/jdbc/tdsparser.java:83)

I'm using logstash 6.5, sqljdbc 4.2 and OpenJDK (Amazon Corretto 8.2 JRE)

When I change the output config to output to a file or console it works fine.

Any help will be appreciated.

mihomir
  • 197
  • 6
  • 15
tomsky
  • 535
  • 4
  • 11
  • 28
  • Perhaps your account doesn't have write access on that database? – baudsp Feb 12 '19 at 10:28
  • The Logstash jdbc output plugin is a [third party plugin](https://github.com/theangryangel/logstash-output-jdbc) and not part of the Logstash core. It is possible that there are issues with newer versions of Logstash. Maybe you can check if the issue can be reproduced with an older version of Logstash? – mihomir Feb 12 '19 at 11:42

1 Answers1

0

I've found a solution to this problem and posting it here in case anyone faces a similar issue.

The logstash_jdbc_output plugin has been installed to logstash using Oracle JDK. Later on, Oracle JDK has been replaced with Open JDK which was the cause of the problem. The solution was to re-install the plugin using Open JDK.

tomsky
  • 535
  • 4
  • 11
  • 28