# Is it possible to configure different tracking\_column for different jdbc queries in single logstash conf file

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998>\
**Category:** Logstash\
**Created:** [June 1, 2017, 11:11pm UTC](https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998 "2017-06-01T23:11:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pks](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pks](https://discuss.elastic.co/u/pks)\
**Post date:** [June 1, 2017, 11:11pm UTC](https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998/1 "2017-06-01T23:11:34Z")

</div>

I have a few queries running via logstash jdbc plugin with tracking\_column as a timestamp from db and using sql\_last\_value while querying. These are set to run every minute. This is working fine.

```
    use_column_value => true
    tracking_column => time_mark
    schedule=>"* * * * *"
    statement => "SELECT xxxx FROM yyyy WHERE zzzz and time_mark>:sql_last_value"

```

However, I want to add another query with schedule as once per day. Hence, the sql\_last\_value metadata file which is getting updated every minute by the current queries cannot be used for this once a day query.

Essentially I want this query to run successfully by getting updated db values only once a day

```
    use_column_value => true
    tracking_column => time_mark
    schedule=>"0 5 * * *"
    statement => "SELECT aaaa FROM bbbb WHERE cccc and time_mark>:sql_last_value"

```

What are the other options? Can there be 2 separate tracking columns for 2 different queries? I tested it and it doesn't seem to be supported. How can I set this up? Any suggestions?

---

<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:** [June 2, 2017, 6:20am UTC](https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998/2 "2017-06-02T06:20:59Z")

</div>

I think the problem is that both jdbc inputs are saving their state into the same file. Make sure you set the [`last_run_metadata_path` option](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-last_run_metadata_path) to unique values for each input.

---

<div class="post-metadata">

**Author:** ![pks](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pks](https://discuss.elastic.co/u/pks)\
**Post date:** [June 2, 2017, 5:15pm UTC](https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998/3 "2017-06-02T17:15:27Z")

</div>

Yes! That was it. Thank you I had missed that parameter while reading up on the jdbc plugin.

---

<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:** [June 30, 2017, 5:15pm UTC](https://discuss.elastic.co/t/is-it-possible-to-configure-different-tracking-column-for-different-jdbc-queries-in-single-logstash-conf-file/87998/4 "2017-06-30T17:15:52Z")

</div>

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