Anant Mittal
Anant Mittal

Reputation: 11

I am continously receiving value 0 in sql_last_value field in logstash conf file.What is the issue?

input {
    jdbc{
        jdbc_connection_string => " "
        jdbc_user => "temos"
        jdbc_password => " "
        jdbc_driver_library => "F:/logstash-6.3.0/bin/ojdbc6.jar"
        jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        statement=>"Select trnref from TANSACTION_IDS where trnref > 
        :sql_last_value order by trnref"
        use_column_value => true
        tracking_column => "trnref"
    }   
}

output {
    elasticsearch{
        index=>"transfernew"
        document_type=>"trans"
        document_id=>"%{trnref}"
        hosts=>"localhost"
    }
}

I have deleted .logstash_last_run file many times and then run the conf file but still the value of sql_last_run is 0.

Upvotes: 1

Views: 1804

Answers (1)

somewhatoff
somewhatoff

Reputation: 981

This is likely due to the column type of your tracking column. As per:

https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-tracking_column_type

this must be numeric or a timestamp. If it is a string (or something else) in your database, you will get a 0 in the metadata file as you describe.

Upvotes: 1

Related Questions