Among other things, following is an input which worked without any issue in version 5.6.5,
jdbc {
jdbc_driver_library => "/etc/logstash/mssql-jdbc-6.2.2.jre8.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://DB_IP:PORT"
jdbc_user => "user_name"
jdbc_password => "password"
schedule => "*/5 * * * *"
statement => "SELECT * FROM db.table WHERE modified > :sql_last_value"
use_column_value => true
tracking_column => "modified"
jdbc_fetch_size => 1000
jdbc_page_size => 1000
jdbc_paging_enabled => true
last_run_metadata_path => "/var/lib/logstash/.logstash_jdbc_last_run"
}
The column modified
has type datetime
(SQL Server). This worked as expect in Logstash version 5.6.5 and the .logstash_jdbc_last_run
file was updated with the value from modified column just fine.
After upgrading to 6.7.0, this setup no longer works. The .logstash_jdbc_last_run
file always ends up getting --- 0
value. Setting tracking_column_type => "timestamp"
yields following error,
[2019-05-02T14:19:00,157][WARN ][logstash.inputs.jdbc] Exception when executing
JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMicrosoftSqlserverJdbc::SQLServerException:
Implicit conversion from data type varchar to timestamp is not allowed.
Use the CONVERT function to run this query.>}