Hi,
I am using JDBC to get data from SQL server, for handling connectivity issues i disabled SQL server and logstash start throwing below error. Does anybody has any idea how can i put condition on this and store error detail in another index. see below error message
[2018 - 09 - 07T16: 09: 15, 165][ERROR][logstash.inputs.jdbc]Unable to connect to database.Tried 1 times {
: error_message => "Java::ComMicrosoftSqlserverJdbc::SQLServerException: The TCP/IP connection to the host 10.20.32.136, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."."
}
[2018 - 09 - 07T16: 09: 15, 165][ERROR][logstash.pipeline]A plugin had an unrecoverable error.Will restart this plugin.
Pipeline_id: main
Plugin: < LogStash::Inputs::Jdbc jdbc_driver_library => "C:\logstash\lib\sqljdbc41.jar", jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver", jdbc_connection_string => "jdbc:sqlserver://10.20.32.136:1433", jdbc_user => "logstash", jdbc_password => < password > , type => "startup", codec => < LogStash::Codecs::JSON id => "json_d94d23db-ba90-4575-a9db-ce2894aa3b7d", enable_metric => true, charset => "UTF-8" > , statement => "SELECT TOP 1 object_name from master.sys.dm_os_performance_counters", id => "29a117901c739d61d7b3c1aa6e22bbb573fa327952dd0615f8ea9cb2b3e8ead4", enable_metric => true, 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_w
ait_time => 0.5, parameters => {
"sql_last_value" => 2018 - 09 - 07 15: 55: 00 - 0500
}, last_run_metadata_path => "C:\Users\jqamer/.logstash_jdbc_last_run", use_column_value => false, tracking_column_type => "numeric", clean_run => false, record_last_run => true, lowercase_column_names => true >
Error: Java::ComMicrosoftSqlserverJdbc::SQLServerException: The TCP / IP connection to the host 10.20.32.136, port 1433 has failed.Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
Exception: Sequel::DatabaseConnectionError
Stack: com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(com / microsoft / sqlserver / jdbc / SQLServerException.java: 191)
com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(com / microsoft / sqlserver / jdbc / SQLServerException.java: 242)
com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(com / microsoft / sqlserver / jdbc / IOBuffer.java: 2280)
com.microsoft.sqlserver.jdbc.TDSChannel.open(com / microsoft / sqlserver / jdbc / IOBuffer.java: 493)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(com / microsoft / sqlserver / jdbc / SQLServerConnection.java: 1388)
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(com / microsoft / sqlserver / jdbc / SQLServerConnection.java: 1069)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(com / microsoft / sqlserver / jdbc / SQLServerConnection.java: 905)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(com / microsoft / sqlserver / jdbc / SQLServerConnection.java: 452)
com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(com / microsoft / sqlserver / jdbc / SQLServerDriver.java: 1014)
java.lang.reflect.Method.invoke(java / lang / reflect / Method)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org / jruby / javasupport / JavaMethod.java: 468)
org.jruby.javasupport.JavaMethod.invokeDirect(org / jruby / javasupport / JavaMethod.java: 326)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.adapters.jdbc.connect(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / adapters / jdbc.rb: 215)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.connection_pool.make_new(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / connection_pool.rb: 127)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.connection_pool.threaded.assign_connection(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / connection_pool / threaded.rb: 206)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.connection_pool.threaded.acquire(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / connection_pool / threaded.rb: 138)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.connection_pool.threaded.hold(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / connection_pool / threaded.rb: 90)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.database.connecting.synchronize(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / database / connecting.rb: 270)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.database.connecting.test_connection(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / database / connecting.rb: 279)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.database.connecting.connect(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / database / connecting.rb: 58)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_10_dot_0.lib.sequel.core.connect(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / sequel - 5.10.0 / lib / sequel / core.rb: 116)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_jdbc_minus_4_dot_3_dot_9.lib.logstash.plugin_mixins.jdbc.block in jdbc_connect(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / logstash - input - jdbc - 4.3.9 / lib / logstash / plugin_mixins / jdbc.rb: 114)
org.jruby.RubyKernel.loop(org / jruby / RubyKernel.java: 1292)
C_3a_.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_jdbc_minus_4_dot_3_dot_9.lib.logstash.plugin_mixins.jdbc.jdbc_connect(C: /logstash/vendor / bundle / jruby / 2.3.0 / gems / logstash - input - jdbc - 4.3.9 / lib / logstash / plugin_mixins / jdbc.rb: 111)