# Sql\_last\_value resets to 0 if logstash restart

**URL:** <https://discuss.elastic.co/t/sql-last-value-resets-to-0-if-logstash-restart/120397>\
**Category:** Logstash\
**Created:** [February 19, 2018, 5:36am UTC](https://discuss.elastic.co/t/sql-last-value-resets-to-0-if-logstash-restart/120397 "2018-02-19T05:36:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timotius\_Pamungkas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timotius_pamungkas/32/42522_2.png) [@Timotius\_Pamungkas](https://discuss.elastic.co/u/Timotius_Pamungkas)\
**Post date:** [February 19, 2018, 5:36am UTC](https://discuss.elastic.co/t/sql-last-value-resets-to-0-if-logstash-restart/120397/1 "2018-02-19T05:36:24Z")

</div>

I'm collecting data from jdbc (MS SQL) with this configuration:

```auto
jdbc {
    jdbc_driver_library => "C:\dev\script\config\mssql-jdbc-6.2.2.jre8.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_connection_string => "jdbc:sqlserver://1.2.3.4:1433;databaseName=MyDB;"
    jdbc_user => "user"
    jdbc_password => " ****"
    jdbc_validate_connection => true
    schedule => "/3 * * * * *"
    statement_filepath => "C:\dev\script\sql\script_es.sql"
    type => "jdbc"
    tags => ["tag1"]
    tracking_column => "createddate"
    use_column_value => true
    clean_run => true  
    last_run_metadata_path => "C:\dev\script\es_jdbc_last_run_metadata.log"
  }

```

The data collected, and tracking\_column works fine. However when I restart the logstash, or change config file and logstash automatically reload (I use flag _--config.reload.automatic_), then the sql\_last\_value reset from 0 again. Hence, every time logstash needs to be restarted (maybe because we add new jdbc input), then existing data is re-pulled from jdbc.

Am I do something wrong? It seems that on restart, sql\_last\_value not read from _C:\dev\script\es\_jdbc\_last\_run\_metadata.log_

Thank you

---

<div class="post-metadata">

**Author:** ![Timotius\_Pamungkas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timotius_pamungkas/32/42522_2.png) [@Timotius\_Pamungkas](https://discuss.elastic.co/u/Timotius_Pamungkas)\
**Post date:** [February 19, 2018, 5:55am UTC](https://discuss.elastic.co/t/sql-last-value-resets-to-0-if-logstash-restart/120397/2 "2018-02-19T05:55:12Z")

</div>

Found it, need to delete **clean\_run** parameter as per documentation

---

<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:** [March 19, 2018, 5:55am UTC](https://discuss.elastic.co/t/sql-last-value-resets-to-0-if-logstash-restart/120397/3 "2018-03-19T05:55:29Z")

</div>

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