For some time i am able to connect DB but after few seconds i get the error "Exception when executing JDBC query "
My logstash config format:
input {
jdbc {
tags => "index.conf"
jdbc_connection_string => "jdbc:sqlserver://XXXXXXX;databaseName=XXXX;Integrated Security=fale;TrustServerCertificate=true;Connect Timeout=600;Command Timeout=120"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_driver_library => "D:\XXXX\XXXX\lib/mssql-jdbc-12.4.1.jre11.jar"
jdbc_user => "XXXXX"
jdbc_password => "XXXXX"
tracking_column => "modifieddate"
use_column_value => true
jdbc_pool_timeout => 50
jdbc_validate_connection => true
jdbc_validation_timeout =>3600
connection_retry_attempts => 2
tracking_column_type => "timestamp"
schedule => "*/2 * * * *"
statement => "SELECT col1,col2,modifieddate AAA WHERE modifieddate > DATEADD(HH,-1,:sql_last_value)"
last_run_metadata_path => "D:\XXXX\XXXX\configfiles\lastrun/.logstash-8.6.2_jdbc_last_run_index"
}
tcp {
codec => fluent
port => 7000
tcp_keep_alive => true
}
}
filter {
if "index.conf" in [tags]{
mutate {
copy => { "col1" => "[col1]"} }
}
}
output {
if "index.conf" in [tags]{
azuresearch {
endpoint => "XXXcognitivesearchXXXX.XXXX.XXXX.Xet"
api_key => "XXXXXXX"
search_index => "admindata"
column_names => ['col1','col2','modifieddate']
}
}
}
Using below:
- MS SQL to connect DB
- Logstash 8.6.2
- output- Azure cognitive search index.
Approaches Tried:
- Increased connection timeout in connection string.
- Added jdbc connection pool timeout
- connection retry
There is no article for this issue to fix. Can anyone pls let me know hot to fix this issue?