Parsing JSON_v2 to influxDB timestamp_timezone not picked up

the output in influxDB cloud (europe-west1-1.gcp.cloud2) is not changing the timestamp to reflect time in my timezone e.g (UTC+03:00)
example of json:

[
{
"name": ...,
"timestamp": 1663830654,
....
},
{
"name": ...,
"timestamp": 1663830654,
...
}
]

my telegraf configuration:

[[inputs.mqtt_consumer]]

    servers = [ "" ]
    qos = 1

    # Topics to subscribe to:
    topics = [
        "...."
    ]

    data_format = "json_v2"

    topic_tag = ""

    [[inputs.mqtt_consumer.json_v2]]
        measurement_name = "status"
        [[inputs.mqtt_consumer.json_v2.object]]
            path = "@this"
            timestamp_key = "timestamp" # A string with valid GJSON path syntax to a valid timestamp (single value)
            timestamp_format = "unix" # A string with a valid timestamp format (see below for possible values)
            timestamp_timezone = "Africa/Kampala"
            tags = ["..."]
            disable_prepend_keys = true

            [inputs.mqtt_consumer.json_v2.object.fields]

Also tried , same result:

[[inputs.mqtt_consumer.json_v2]]
        measurement_name = "status"
        timestamp_path = "timestamp" 
        timestamp_format = "unix"
        timestamp_timezone = "Africa/Kampala"

        [[inputs.mqtt_consumer.json_v2.object]]
            path = "@this"
            timestamp_key = "timestamp" # A string with valid GJSON path syntax to a valid timestamp (single value)
            timestamp_format = "unix" # A string with a valid timestamp format (see below for possible values)
            timestamp_timezone = "Africa/Kampala"
            tags = ["..."]
            disable_prepend_keys = true

            [inputs.mqtt_consumer.json_v2.object.fields]

My understanding is that unix timestamps are all in UTC, so I don’t think that field should have any effect. @sspaink, does that sound right?

1 Like

Correct, when using “unix”, “unix_ms”, “unix_us”, or “unix_ns” the location won’t be used.
Relevant snippet of code that shows this behavior: telegraf/internal.go at a57434eb4ee8c6e452048209b3353ba48f9bc3ab · influxdata/telegraf · GitHub

1 Like