LogStash seems to mask jdbc sql exception and exits with code 0

/usr/share/logstash/bin/logstash --path.data /usr/share/logstash/data_supplier -f ./supplier.conf
...
Starting Logstash {"logstash.version"=>"7.10.2", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 11.0.8+10 on 11.0.8+10 +indy +jit [linux-x86_64]"}
...
...
[2021-04-19T08:07:27,165][ERROR][logstash.inputs.jdbc ][main][e89be066d55503230f6906f1e2b416e65d8c62260bcc6fd090181d50050120XX] Java::ComSapDbJdbcExceptions::JDBCDriverException: SAP DBTech JDBC: [257] (at 33): sql syntax error: incorrect syntax near "": line 1 col 33 (at pos 33):
..
[2021-04-19T08:07:27,185][WARN ][logstash.inputs.jdbc ][main][e89be066d55503230f6906f1e2b416e65d8c62260bcc6fd090181d50050120XX] Exception when executing JDBC query {:exception=>"Java::ComSapDbJdbcExceptions::JDBCDriverException: SAP DBTech JDBC: [257] (at 33): sql syntax error: incorrect syntax near "\": line 1 col 33 (at pos 33)"}

84[2021-04-19T08:07:28,349][INFO ][logstash.javapipeline ][main] Pipeline terminated {"pipeline.id"=>"main"}

85[2021-04-19T08:07:28,398][INFO ][logstash.pipelinesregistry] Removed pipeline from registry successfully {:pipeline_id=>:main}

86[2021-04-19T08:07:28,438][INFO ][logstash.runner ] Logstash shut down.

bash-4.2$ echo $?
0

I figured out how to fix my sql error in the conf file but I was expecting logstash to exit with 1 because of the error. This logstash ingest is part of a bigger data pipeline.

What's a better way to check that logstash succeeded without error or exceptions if I can't depend on exit code?

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