I’ve got a CSV where the timestamp has this format:
The time zone I want to insert is from Spain (ie UTC+1 half of the year and UTC+2 the other half).
In the header of the file I define it as:
#datatype tag;measurement;double;dateTime:2006-01-02 15:04:05;string;tag;string
How do I explain to Influx to store it at Spain timezone? I imagine that if I don’t indicate where the timezone is from, it will store it as UTC, so it will be wrong for what I need
Thanks in regards
I simply think that’s not possible (at least directly).
Telegraf\InfluxDB will use UTC for any autogenerated or interpreted timestamp.
If your values have an offset that’s not written\reported in the value itself then the timezone info is simply not present and can’t be used by Telegraf\InfluxDB.
I see the following options:
- Generate the data with UTC timestamp or Timezone info
- pre-Process your file to “fix” the timestamps
- if you are using Telegraf you can use the Exec plugin to run a script that: reads the file, fixes the timestamps, and writes the data
I use the command “influx write” instead of Telegraf.
After what you say to me, what I’m gonna do is to update the datetime into Spanish time zone Via SQL and store it as usual.
Or is there any other way to specify that the timestamp is written in the CSV is from Spain?
How do I indicate to the CSV that the timezone is UTC+1?
This annotation isn’t supported.
Your SQL Database should be able to convert DateTime into UTC directly (so you won’t even have to deal with offset), the other option is to
CAST or CONVERT your timestamp to a DateTime format with timezone which may look like this
2015-10-25 02:00:00 +02:00, how to do that is database dependant.
If you decide to use DateTime with timezone the format string in your header must be changed accordingly