Telegraf version: 1.19.3
Influx version: 1.8.3
I have this Json file:
I’m using the plugin in Telegraf input.file
this is my configuration:
In InfluxDB only show this last data
i dont understand why dont show all datas
thanks
Telegraf version: 1.19.3
Influx version: 1.8.3
I have this Json file:
I’m using the plugin in Telegraf input.file
this is my configuration:
In InfluxDB only show this last data
i dont understand why dont show all datas
thanks
Hi,
It is a lot easier to help when you paste your text in and do not use screenshots.
Assuming I copied your config correct combined with your demo data, this is what is parsed by telegraf:
./telegraf --config config.toml --test
2021-11-15T16:28:26Z I! Starting Telegraf
> file _id="a",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="20.77",type="temperature" 1636993707000000000
> file _id="b",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="38.11",type="humidity" 1636993707000000000
> file _id="c",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="400.00",type="co2" 1636993707000000000
> file _id="d",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="1.00",type="pm25" 1636993707000000000
> file _id="e",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="9.00",type="covid19" 1636993707000000000
InfluxDB Line Protocol identifies unique datapoints by the metric name + tags + date. In this case there are no tags, and the time is the same on every observation. Therefore, the last metric is what InfluxDB will record, which is what you are seeing.
Tags are string values that InfluxDB will index. In this case, using the type field would be a good tag. This can be added by:
tag_keys = ["type"]
Which would produce the following datapoints, now each with a unique tag:
./telegraf --config config.toml --test
2021-11-15T16:31:18Z I! Starting Telegraf
> file,type=temperature _id="a",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="20.77" 1636993878000000000
> file,type=humidity _id="b",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="38.11" 1636993878000000000
> file,type=co2 _id="c",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="400.00" 1636993878000000000
> file,type=pm25 _id="d",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="1.00" 1636993878000000000
> file,type=covid19 _id="e",measurements_0__id="1",measurements_0_date=1636746190653,measurements_0_value="9.00" 1636993878000000000
I have already found the solution, the problem that only had one tag and since the tag and the time were always the same, the data was overwritten.
thanks for answering.