# Syncing mysql table to influxdb

**URL:** <https://discuss.elastic.co/t/syncing-mysql-table-to-influxdb/76506>\
**Category:** Logstash\
**Created:** [February 25, 2017, 11:25pm UTC](https://discuss.elastic.co/t/syncing-mysql-table-to-influxdb/76506 "2017-02-25T23:25:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ash007](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@ash007](https://discuss.elastic.co/u/ash007)\
**Post date:** [February 25, 2017, 11:25pm UTC](https://discuss.elastic.co/t/syncing-mysql-table-to-influxdb/76506/1 "2017-02-25T23:25:48Z")

</div>

I am trying to sync a mysql table in influxdb. Following is my test.conf file.

```
input {
  jdbc {
jdbc_driver_library => "/root/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "db_endpoint"
jdbc_user => "username"
jdbc_password => "password"
#parameters => { "favorite_artist" => "Beethoven" }
#schedule => "* * * * *"
statement => "SELECT * FROM table limit 10"
  }
}
output {
stdout {codec => json_lines }
file {
   path => "/root/response.json"
# codec => "plain"
# "document_id" => "%{operation_date}"
}
}

```

For testing i am trying to store the output from mysql query in a file "response.json". I am trying to sync the mysql table to the current file using "document\_id =\> "%{uid}" but its not working and duplicate records are being stored in the file. I read the documentation and it looks like this setting is only used for elasticsearch output configuration. how can i achieve a sync between the mysql table and records in file/influxdb?  
Thanks.

---

<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:** [February 28, 2017, 7:18am UTC](https://discuss.elastic.co/t/syncing-mysql-table-to-influxdb/76506/2 "2017-02-28T07:18:09Z")

</div>

You need to use the jdbc input's ability to only select rows that have been added or updated since the last run. Read what's said about the `sql_last_value` parameter in the 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 28, 2017, 7:18am UTC](https://discuss.elastic.co/t/syncing-mysql-table-to-influxdb/76506/3 "2017-03-28T07:18:18Z")

</div>

Closed on March 28, 2017, 7:18am UTC

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