Sql_last_value resets to 0 upon restart

It seems the variable sql_last_value gets reset every time I restart logstash. As per the documentation and all other threads it should look at last_run_metadata_path for the last saved value. I see the last_run_metadata_path is getting updated but sql_last_value getting reset to 0 on restart.

Here is my input -

jdbc {
    jdbc_driver_library => "C:\sqljdbc_6.4\enu\mssql-jdbc-6.4.0.jre8.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_connection_string => "jdbc:sqlserver://host:1433;databaseName=db"
    jdbc_user => "user"
    jdbc_password => "pwd"
    schedule => "* * * * * *"
    statement => "SELECT * FROM dbo.IPR_LOG WHERE s_no  > :sql_last_value"
    use_column_value => true
    tracking_column_type => "numeric"
    tracking_column => "s_no"
    last_run_metadata_path => "C:\Users\xyz\.custom_log"
    type => "log"

For the note,
s_no is a "numeric" sql type value in the table.
I am also assuming that clean_run => false by default.

1 Like

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