Insterting data through a txt file

Hi,

I want to insert data in influxdb through a txt file. But i want to send the time as well but as the precision rfc3339 format.

So i thought that this was the solution:
Txt file: cpu,host=server02 value=0.67 2020-03-31T15:00:00Z
Terminal: curl -i -XPOST ‘http://localhost:8086/write?db=test&precision=RFC3339’ --data-binary @InfluxData.txt

But if i do that i got the following error

Btw: if i don’t give a timestamp in the textfile it does log the data at the servertime so the link to the txt file is no problem.

Do anybody know if it is possible in the first place?

Thanks at advance!
Kind regards,
Ward

Hello @Roekens,
Welcome!
Time must be in unix timestamp for line protocol. Otherwise if you want to keep the data in rfc3339 you could use the file or tail plugin.
You can also write a txt with influx -import -path=yourfilepath -precision=ns
then before you query you can use ```precision rfc3339```` to convert the unix timstamp to rfc3339.
I recommend taking a look at this documentation and this blog on how to write data to Influxdb using the import command and some telegraf plugins.

1 Like

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