Syncing mysql table to influxdb

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.

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.

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