We're running Logstash with jdbc plugin as a Kubernetes cron job. Due to some network problem, eventually it cannot connect to database:
[ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLRecoverableException: IO Error: Unknown host specified "}
And then, plugin is restarted:
[ERROR][logstash.pipeline ] A plugin had an unrecoverable error. Will restart this plugin.
Fail and restart cycle can be repeated several times. When the connection is finally succeeded and the pipeline has terminated, Logstash seems to be stalled and the Kubernetes pod doesn't succeed nor fail.
I can add an option like connection_retry_attempts => 10
, but that doesn't garantee that, at the end of those attempts, if connection fails, the plugin will be restarted.
It seems to me it would be better to get an error and finish Logstash. Is it possible, in some way, to prevent the plugin from being restarted?
jdbc {
jdbc_connection_string => "..."
jdbc_user => "..."
jdbc_password => "..."
jdbc_validate_connection => true
jdbc_driver_library => "/opt/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
last_run_metadata_path => "..."
tracking_column => "..."
tracking_column_type => "timestamp"
statement_filepath => "..."
}