# Jdbc input plugin sql\_last\_value not updating

**URL:** <https://discuss.elastic.co/t/jdbc-input-plugin-sql-last-value-not-updating/207409>\
**Category:** Logstash\
**Created:** [November 11, 2019, 6:37pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-sql-last-value-not-updating/207409 "2019-11-11T18:37:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ma3](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@ma3](https://discuss.elastic.co/u/ma3)\
**Post date:** [November 11, 2019, 6:37pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-sql-last-value-not-updating/207409/1 "2019-11-11T18:37:03Z")

</div>

I have multiple jdbc input plugins in logstash writing to different indices in elastic search.

I'm using sql\_last\_value to send incremental updates. However, the timestamp in `last_run_metadata_path` is only getting updated where there are updates to the MySQL database. If there are no updates, timestamp in the `last_run_metadata_path` file is not updating. Is this expected?

I deleted the files and restarted logstash. However, the old timestamps are back. Has anyone seen this?

---

<div class="post-metadata">

**Author:** ![Shaoranlaos](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Shaoranlaos](https://discuss.elastic.co/u/Shaoranlaos)\
**Post date:** [November 12, 2019, 6:26am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-sql-last-value-not-updating/207409/2 "2019-11-12T06:26:26Z")

</div>

The sqllast\_value is only updated when there are changes seen in the database, because the value is update with the last value read from the database (so the greatest value in your tracking column).  
[https://www.elastic.co/guide/en/logstash/6.2/plugins-inputs-jdbc.html#\_state](https://www.elastic.co/guide/en/logstash/6.2/plugins-inputs-jdbc.html#_state)

Deleting the file while logstash is running isn't of use because logstash writes the file again on shutdown to preserve the last state. To start a new you would have to shutdown logstash, delete the file and start logstash again (or use the config option clean\_run to ignore the value saved).

---

<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:** [December 10, 2019, 6:26am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-sql-last-value-not-updating/207409/3 "2019-12-10T06:26:28Z")

</div>

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