How to set timezone for telegraf?

Hi,

Over the weekend, the UK changed from GMT (ie UTC) to BST which is UTC -1. Our server time also changed to BST

Our telegraf agent is tailing a file in CSV format, and has not taken this into account so times are one hour ahead of actual time.

We have an application that generates the file in this format which Telegraf tails and stores in Influx.

time TESTRUNID METRICNAME METRICVALUE
20190401T14:41:14.000000 f31a7c4 APP_A 1
20190401T14:41:15.000000 f31a7c4 APP_A 2

Our inputs.tail configuration is

[[inputs.tail]]
    files = ["/autotest/spike-ansible/filea.csv"]
    from_beginning = false
    watch_method = "inotify"
    data_format = "csv"
    csv_header_row_count = 1
    csv_delimiter = ","
    csv_timestamp_column = "time"
    csv_timestamp_format = "20060102T15:04:05.000000"
    csv_tag_columns = ["TESTRUNID"]
    csv_measurement_column = "METRICNAME"

I’ve tried adding timezone = “Local” at various places in telegraf’s configuration file, with but either it ignored it, or refused to start…

So how do I set the timezone in Telegraf so that it follows the server timezone?

Kind regards,

Richard

Hi RichardLucas ,

influx always stores the times in UTC , you cannot configure telegraf to use a different timezone
you can check if the data is stored correctly by using TZ in your query …

for example :

select * from “1H_1M”.shardtest TZ(‘Europe/London’)

hope this helps , best regards

2 Likes

Hi Marc
Thanks for your answer, it confirms our theory that Telegraf treats all time stamps as UTC.
We’ll think of away of ensuring that the timestamps in the tailed file are in UTC rather than BST.

Thanks again for your help. +1 on the beer tab

Kind regards,

Richard

1 Like