# Sql\_last\_value reset to 0 at 12 hour

**URL:** <https://discuss.elastic.co/t/sql-last-value-reset-to-0-at-12-hour/228428>\
**Category:** Logstash\
**Created:** [April 17, 2020, 2:13am UTC](https://discuss.elastic.co/t/sql-last-value-reset-to-0-at-12-hour/228428 "2020-04-17T02:13:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veeru\_Badavath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veeru_badavath/32/66481_2.png) [@Veeru\_Badavath](https://discuss.elastic.co/u/Veeru_Badavath)\
**Post date:** [April 17, 2020, 2:13am UTC](https://discuss.elastic.co/t/sql-last-value-reset-to-0-at-12-hour/228428/1 "2020-04-17T02:13:12Z")

</div>

Hi,  
I am new to ELK stack. I am planning to fetch data from Oracle table to visualise data in Kibana. My table doesn't have primary key column so based timestamp (format: hhmmss eg. 00001) column scheduling to fetch incremental record using "sql\_last\_value".  
The issue what I am facing with **sql\_last\_value** as it's value at end of the day will be set with 235959. When the next day starts **sql\_last\_value** value should replace with 0 other wise as timestamp again start from 000000. Hence records cannot be retrieved.

```
      input {
      jdbc { 
        jdbc_connection_string => "jdbc:mysql://localhost:3306/elk"
        # The user we wish to execute our statement as
        jdbc_user => "jesus"
        jdbc_password => "Jesus@12345"
        # The path to our downloaded jdbc driver
        jdbc_driver_library => "path to oracle jar"
        jdbc_driver_class => "oracle driver"
        # our query
        statement => "SELECT *,id,refnum FROM storeData where localTime>:sql_last_value"
        use_column_value => true
        tracking_column => "id"
        last_run_metadata_path => "/media/jesus/HD4/Software/ELK/.logstash_jdbc_last_run"
        schedule => "*/5 * * * * *"
        }
      }
    output {
     stdout { codec => rubydebug }
      elasticsearch {
      "hosts" => "localhost:9200"
      "index" => "test-2"
      "document_type" => "data"
       "document_id" => "%{id}%{refnum}"
      }
    }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 15, 2020, 2:13am UTC](https://discuss.elastic.co/t/sql-last-value-reset-to-0-at-12-hour/228428/2 "2020-05-15T02:13:14Z")

</div>

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