Hi,
I am trying to migrate data from MSSQL to InfluxDB for testing purpose.
I have set up entire telegraf config but still have a problem with mapping “time_event” field from MSSQL to timestamp in InfluxDB. Format from MSSQL is datetime2(7). I tried to convert it into different format, without success. It still shows time_event as field and timestamp is created by InfluxDB.
Same problem I seem to have with creating tag. “machine_id” field defined as a tag still shows up in test logs as a field.
Below is my config for SQL input. Most likely it is something basic that I am missing, but will be super grateful for support.
[[inputs.sql.query]]
query = “SELECT time_event, machine_id, recipe, machine_state, machine_mode, machine_speed, machine_speed_t, good_count, reject_count FROM dbo.oee1 WHERE time_event > DATEADD(second, -120, GETUTCDATE())”
measurement = “production_oee”
time_column = “time_event”
tag_columns_include = [“machine_id”]
field_columns_int = [“machine_state”, “machine_mode”, “machine_speed_t”, “good_count”, “reject_count”]
field_columns_float = [“machine_speed”]
field_columns_string = [“recipe”]
[[processors.converter]]
[processors.converter.tags]
string = [“machine_id”]
[[processors.dedup]]
dedup_interval = “360s”
Logs from testing Telegraf. machine_id as well as time_event are still in the fields.
production_oee,host=xxx good_count=7499786i,machine_id=“1021”,machine_mode=1i,machine_speed=0,machine_speed_t=24i,machine_state=9i,recipe=“xx”,reject_count=120217i,time_event=1772537862974086100i 1772537863000000000
