Change timestamp from ms to ns before saving to influxdb

Hello, I am trying to display data from a sensor on a Grafana dashboard and have a problem with the unit of the timestamp.
This is my current setup: sensor->MQTT->telegraf->kapacitor->influxdb->grafana
I have tested the setup and it works, but the timestamp of the data (formatted as line protocol) my sensor sends to my server is in [ms] (eg. 1575078827764). Grafana thinks this value is in [ns] and will display it in the past, and not at the current unix time in [ms].
Is there a way to change it to [ns] (for example multiply it by 1000000) in any part of my setup? This would help reduce the amount of data the sensor has to send and the data would get stored as the correct value in [ns] in the database.

Thanks for any help and suggestions!

Hi @gerge,

Multiplying your timestamp in ms by 1,000,000 to transform it to ns would work. Is that something you would be able to do at the sensor?

Hi, @noahcrowley ,
Yes, of course this would be possible, but I would like to save the 6 zeros on every message.
I was wondering if it is possible to perform this operation on another step in my setup.

@gerge you really should consider manipulating the data before it gets to telegraf. That would make it more consistent and less prone to errors.

I don’t believe there is a way to change that timestamp like you are trying. There might be a way to configure telegraf to send the data in ms instead and let influx store it correctly

What version of telegraf and influxdb are you using?

Hi, the current versions of my setup are:
Telegraf: 1.12.4 (with [[inputs.mqtt_consumer]] and [[outputs.influxdb]])
Kapacitor: 1.5.2
InfluxDB: 1.7.9
Grafana: 6.4.4