We have into logstash pipeline the config to search into database and get the data, after the first search we want only select the new data, to do this we use the config of jdbc plugin, my pipeline config.
input {
jdbc {
jdbc_driver_library => "/usr/share/logstash/jdbc-drivers/ojdbc10.jar"
jdbc_driver_class => "oracle.jdbc.OracleDriver"
jdbc_connection_string => "*********"
jdbc_user => "user"
jdbc_password => "pass"
statement => "SELECT transaction_pk, sndiso, receivingiso, poc, servicetype, duration, start_date, end_date FROM table vk WHERE start_date > :sql_last_value"
use_column_value => true
tracking_column => "start_date"
tracking_column_type => "timestamp"
schedule => "* * * * *"
last_run_metadata_path => "/etc/logstash/test-jdbc-int-sql_last_value.yml"
}
}
filter {
....
}
output {
....
}
the file /etc/logstash/test-jdbc-int-sql_last_value.yml contains this
cat /etc/logstash/test-jdbc-int-sql_last_value.yml
--- 1970-01-01 00:00:00.000000000 Z
and in the execution log apears this error
[2023-08-08T14:13:00,971][ERROR][logstash.inputs.jdbc ] Java::JavaSql::SQLDataException: ORA-01846: not a valid day of the week: SELECT transaction_pk, sndiso, receivingiso, poc, servicetype, duration, start_date, end_date FROM table vk WHERE start_date > TIMESTAMP '1970-01-01 00:00:00.000000 +00:00'
[2023-08-08T14:13:00,972][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>Sequel::DatabaseError, :message=>"Java::JavaSql::SQLDataException: ORA-01846: not a valid day of the week\n", :cause=>"#<Java::JavaSql::SQLDataException: ORA-01846: not a valid day of the week\n>"}
Thanks