# Jdbc sql\_last\_value

**URL:** https://discuss.elastic.co/t/jdbc-sql-last-value/69156
**Category:** Logstash
**Created:** [December 15, 2016, 11:07am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value/69156 "2016-12-15T11:07:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [December 15, 2016, 11:07am UTC](https://discuss.elastic.co/t/jdbc-sql-last-value/69156/1 "2016-12-15T11:07:44Z")

</div>

Hi  
i have a few tables in MSSQL and ORACLE DB that i want to insert to elasticsearch  
i am using logstash for that with the jdbc input  
i want the statement to run every 3 minutes  
now i dont know how to "tell" logstash to read only new rows (that it didn't read before)  
i tried to use sql\_last\_value - but there is one thing i didnt understand  
does the sql\_last\_value value is the same to all queries? (or each jdbc input gets it's own value)

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 18, 2016, 9:04pm UTC](https://discuss.elastic.co/t/jdbc-sql-last-value/69156/2 "2016-12-18T21:04:53Z")

</div>

The value of the `sql_last_value` parameter comes from one of the column values in the last row that was fetched. If you have multiple jdbc inputs you should set the `last_run_metadata_path` option to a path that's unique for each input.

---

<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: [January 15, 2017, 9:04pm UTC](https://discuss.elastic.co/t/jdbc-sql-last-value/69156/3 "2017-01-15T21:04:53Z")

</div>

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