Logstash - After a certain amount of time, can not connect to the database

I am using version 6.2.1 of logstash.
Use jdbc input to read MSSQL data every hour and then send data to remote logstash.
3-4 days work well. But after that I get the following error, but I have not found a reason yet.
I changed the jdbc library and changed the jdbc_validate_connection setting, but I get the same error.

Does anyone have anybody who can help me?

logstash config.yml)

input {
jdbc {
jdbc_driver_library => "/data/logstash-6.2.1/lib/mssql-jdbc-6.4.0.jre8.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://xxx.xxx.xxx.xxx:xxxx;databaseName=xxx;user=xxxx;password=xxxx;"
jdbc_user => "xxxxx"
jdbc_password => "xxxxx"
schedule => "*/60 * * * *"
add_field => {
"[fields][loc]" => "xxx"
"[fields][title]" => "xxxxx"
parameters => {
"nCode" => "xxxx"
statement => "EXEC [xxxx].[dbo].[xxxxx] 'xxxxx', :nCode, :sql_last_value"
use_column_value => true
jdbc_validate_connection => true
tracking_column => "xxxx"
tracking_column_type => "numeric"
last_run_metadata_path => "file:///data/logstash-6.2.1/query/last_run/xxxxx"
output {
tcp {
host => "xxx.xxx.xxx.xxx"
port => xxxx
codec => "json_lines"


[2018-08-21T10:02:53,233][INFO ][logstash.inputs.jdbc ] (4.238490s) EXEC [xxx].[dbo].[xxxxx] 'xxxx', N'xxx', N'xxxxxx' <- So far, it works fine.

[2018-08-21T10:02:58,932][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times <- At some point, an error occurs.{:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: Connection reset ClientConnectionId:c818c947-d26f-43e2-a738-235ef0ba6b1b"}
[2018-08-21T10:02:58,932][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: Connection reset ClientConnectionId:fe018f0e-36ae-4d77-b26d-16ac3827cc28"}
[2018-08-21T10:02:58,934][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Connection reset ClientConnectionId:d5946694-2fa9-40c9-8f17-fbee4af2167e"."}

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