Skip to content

json_v2 parser - unix_ns timestamp not correct #10405

@hansij66

Description

@hansij66

Relevent telegraf.conf

...
  data_format = "json_v2"
  [[inputs.mqtt_consumer.json_v2]]
    measurement_name = "test"
    timestamp_path = "@this.timestamp"
    timestamp_format = "unix_ns"

Logs from Telegraf

N/A

System info

docker telegraf:latest (1.21.2)

Docker

No response

Steps to reproduce

  1. MQTT payload: {"timestamp":1641667732350000000, .............}
  2. InfluxDB timestamp: 1641667732350000128

There is a small variation in the influxdb timestamp compared to MQTT timestamp.

(note, I also have an input.mqtt_consumer defined with data_format = "influx", which also receives a unix_ns timestamp; this timestamp is exactly forwarded to influxdb

Expected behavior

  1. MQTT payload: {"timestamp":1641667732350000000, .............}
  2. InfluxDB timestamp: 1641667732350000000

Actual behavior

  1. MQTT payload: {"timestamp":1641667732350000000, .............}
  2. InfluxDB timestamp: 1641667732350000128

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mqttbugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions