# Grab data from mysql using more than one tracking column

**URL:** <https://discuss.elastic.co/t/grab-data-from-mysql-using-more-than-one-tracking-column/211477>\
**Category:** Logstash\
**Created:** [December 11, 2019, 2:19pm UTC](https://discuss.elastic.co/t/grab-data-from-mysql-using-more-than-one-tracking-column/211477 "2019-12-11T14:19:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fim/32/90645_2.png) [@fim](https://discuss.elastic.co/u/fim)\
**Post date:** [December 11, 2019, 2:19pm UTC](https://discuss.elastic.co/t/grab-data-from-mysql-using-more-than-one-tracking-column/211477/1 "2019-12-11T14:19:45Z")

</div>

Hi Community

I grab data from a mysql database using logstash' on a regular basis.

In the mysql database the primary key is based on three columns instead of a single id column as primary key.

How can I set more than one key as the tracking value in the logstash pipeline? Is this possible?

Below you see "tracking\_column =\> "id" but I would like to track based on three values: "tracking\_column =\> ["id1", "id2", "id3"]

```
input {
    jdbc {
        jdbc_driver_library => "/usr/share/java/mysql-connector-java-8.0.17/mysql-connector-java-8.0.17.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => " "
        jdbc_user => " "
        jdbc_password => " "
        statement => "SELECT ..."
        use_column_value => true
        tracking_column => "id"
        jdbc_paging_enabled => true
        jdbc_page_size => 10000
        jdbc_fetch_size => 10000
        schedule => "*/1 * * * *" #every 1m
        clean_run => false
    }
}
```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [December 11, 2019, 3:44pm UTC](https://discuss.elastic.co/t/grab-data-from-mysql-using-more-than-one-tracking-column/211477/2 "2019-12-11T15:44:54Z")

</div>

If your DB has a syntax for CONCAT ... AS then you should be able to concatenate the three columns and use the synthetic result as a tracking column.

---

<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 8, 2020, 3:44pm UTC](https://discuss.elastic.co/t/grab-data-from-mysql-using-more-than-one-tracking-column/211477/3 "2020-01-08T15:44:58Z")

</div>

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