SQL Server data to Elasticsearch using LogStash

hey ELK fam,
Im trying to connect SQL sever with logstash, but unable to connect with SQLsever here are log can anyone please help me out.

regards
shahrukh




**[2021-07-29T18:21:41,590][ERROR][logstash.inputs.jdbc     ][main][83da8d4bf0fe18a9b97860744f6215fb537360c2f3830b3335e8503e8d894b6a] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaLang::NoClassDefFoundError: javax/xml/bind/DatatypeConverter"}
> [2021-07-29T18:21:41,621][ERROR][logstash.javapipeline    ][main][83da8d4bf0fe18a9b97860744f6215fb537360c2f3830b3335e8503e8d894b6a] A plugin had an unrecoverable error. Will restart this plugin.
>   Pipeline_id:main
>   Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"nil", statement=>"select top 1000000000 * from xxxxxxxxxxxxxx", jdbc_driver_library=>"C:\\ELK7.11.0\\logstash-7.11.0-windows-x86_64\\logstash-7.11.0\\MicrosoftJDBCDriver6.0forSQLServer\\sqljdbc_6.0\\enu\\sqljdbc42.jar", jdbc_connection_string=>"jdbc:sqlserver://XXXXXX ; database=XXXXXX ; user=XXXXXX ; password=XXXXXX", id=>"83da8d4bf0fe18a9b97860744f6215fb537360c2f3830b3335e8503e8d894b6a", jdbc_driver_class=>"com.microsoft.sqlserver.jdbc.SQLServerDriver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_c4a74c7f-4e96-4b5b-9643-ca4ee317cf71", 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, plugin_timezone=>"utc", last_run_metadata_path=>"C:\\Users\\biuser/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true, use_prepared_statements=>false>
>   Error: Java::JavaLang::NoClassDefFoundError: javax/xml/bind/DatatypeConverter
>   Exception: Sequel::DatabaseConnectionError
>   Stack: com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:4098)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3160)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:43)
> com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3123)
> com.microsoft.sqlserver.jdbc.TDSCommand.execute(com/microsoft/sqlserver/jdbc/IOBuffer.java:7505)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2445)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:1981)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.login(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:1628)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:1459)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:773)
> com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(com/microsoft/sqlserver/jdbc/SQLServerDriver.java:1168)
> java.sql.DriverManager.getConnection(java/sql/DriverManager.java:677)
> java.sql.DriverManager.getConnection(java/sql/DriverManager.java:251)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
> java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:567)
> org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:426)
> org.jruby.javasupport.JavaMethod.invokeStaticDirect(org/jruby/javasupport/JavaMethod.java:358)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.adapters.jdbc.connect(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/adapters/jdbc.rb:227)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.connection_pool.make_new(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/connection_pool.rb:122)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.connection_pool.threaded.assign_connection(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/connection_pool/threaded.rb:209)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.connection_pool.threaded.acquire(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/connection_pool/threaded.rb:139)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.connection_pool.threaded.hold(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/connection_pool/threaded.rb:91)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.database.connecting.synchronize(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/database/connecting.rb:269)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.database.connecting.test_connection(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/database/connecting.rb:278)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.database.misc.initialize(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/database/misc.rb:169)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.database.connecting.connect(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/database/connecting.rb:57)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.sequel_minus_5_dot_39_dot_0.lib.sequel.core.connect(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/sequel-5.39.0/lib/sequel/core.rb:124)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.plugin_mixins.jdbc.jdbc.jdbc_connect(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/plugin_mixins/jdbc/jdbc.rb:114)
> org.jruby.RubyKernel.loop(org/jruby/RubyKernel.java:1442)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.plugin_mixins.jdbc.jdbc.jdbc_connect(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/plugin_mixins/jdbc/jdbc.rb:111)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.plugin_mixins.jdbc.jdbc.open_jdbc_connection(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/plugin_mixins/jdbc/jdbc.rb:139)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.plugin_mixins.jdbc.jdbc.execute_statement(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/plugin_mixins/jdbc/jdbc.rb:197)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.inputs.jdbc.execute_query(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/inputs/jdbc.rb:316)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_integration_minus_jdbc_minus_5_dot_0_dot_6.lib.logstash.inputs.jdbc.run(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.6/lib/logstash/inputs/jdbc.rb:284)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.logstash_minus_core.lib.logstash.java_pipeline.inputworker(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/logstash-core/lib/logstash/java_pipeline.rb:405)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.logstash_minus_core.lib.logstash.java_pipeline.RUBY$method$inputworker$0$__VARARGS__(C_3a_/ELK7_dot_11_dot_0/logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64/logstash_minus_7_dot_11_dot_0/logstash_minus_core/lib/logstash/C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/logstash-core/lib/logstash/java_pipeline.rb)
> C_3a_.ELK7_dot_11_dot_0.logstash_minus_7_dot_11_dot_0_minus_windows_minus_x86_64.logstash_minus_7_dot_11_dot_0.logstash_minus_core.lib.logstash.java_pipeline.start_input(C:/ELK7.11.0/logstash-7.11.0-windows-x86_64/logstash-7.11.0/logstash-core/lib/logstash/java_pipeline.rb:396)
> org.jruby.RubyProc.call(org/jruby/RubyProc.java:318)
> java.lang.Thread.run(java/lang/Thread.java:835)


here is the config file


input {  
    jdbc {
      
        jdbc_connection_string => "jdbc:sqlserver://XXXXX ; database=XXXXX ; user=XXXXX ; password=XXXXX"
        jdbc_user => nil
        jdbc_driver_library => "C:\ELK7.11.0\logstash-7.11.0-windows-x86_64\logstash-7.11.0\MicrosoftJDBCDriver6.0forSQLServer\sqljdbc_6.0\enu\sqljdbc42.jar"
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        statement => "select top 1000000000 * from XXXXX"

      
    }
}

output {  
elasticsearch 
    {
        hosts => ["XXXXX:XXXXX"]
        index => ["XXXXX"]
        user => "XXXXX"
        password =>"XXXXX"
    }
     
}

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