We are looking to use prepared statements with the Jdbc input plugin, where the source database is a Db2 instance. So far we've not been using prepared statements, so that the relevant part of the (working) config looks so
input
{
jdbc
{
statement => "SELECT * from my_table where timestamp_field>:sql_last_value order by timestamp_field ASC"
use_column_value => true
tracking_column => timestamp_field
tracking_column_type => "timestamp"
last_run_metadata_path => "/my_jdbc_last_run"
}
}
Converted to prepared statements like so
input
{
jdbc
{
statement => "SELECT * from my_table where timestamp_field> ? order by timestamp_field ASC"
prepared_statement_bind_values => [ ":sql_last_value" ]
prepared_statement_name => "get_my_data"
use_prepared_statements => true
use_column_value => true
tracking_column => inststl
tracking_column_type => "timestamp"
last_run_metadata_path => "/prep_jdbc_last_run"
}
}
however leads to problems, as the insertion for ? features a timestamp with time zone such as 1970-01-01 00:00:00 UTC. Unfortunately, the field in the table is just a timestamp, no attached time zone, so the Db2 instance is unable to resolve it out of the box. We are still looking if we can adjust the statement to resolve the time zone, but if logstash were not to send it in it the first place we'd be happy too.
We have tried setting values for plugin_timezone and jdbc_default_timezone in hope that logstash would resolve the delta amiably, but the time zone is still shown in the passed value.
