Timestamp in result different than in source file

Windows Server 2019
InfluxDB 2.0.8
Telegraf 1.20.0-rc0


files = ["C:/example.xml"]
data_format = "xml"


metric_name = "string('Example')"
timestamp = "concat(substring(/Report/StartTime, 7, 4), '-', substring(/Report/StartTime, 1, 2), '-', substring(/Report/StartTime, 4, 2), 'T', substring(/Report/StartTime, 12, 2), ':', substring(/Report/StartTime, 15, 2), ':', substring(/Report/StartTime, 18, 2))" 
timestamp_format = "2006-01-02T15:04:05"



example = "number(/Report/Values/valueA)"


  <StartTime>09/15/2021 07:00:00</StartTime>

Result in Data Explorer:

How on earth do I end up with 7:01:00 as a result having 7:00:00 in xml file? :exploding_head:

To me looks like the timestamp you are getting is the actual insert timestamp, I’ve tried your example and it works correctly.

if I run the command: .\telegraf.exe --config .\telegraf.conf --test
I get this lineprotocol output:
Example,host=QDLP03 example=410.66 1631689200000000000

If I translate it back to a readable date (always using powerhsell)

$origin = New-Object -Type DateTime -ArgumentList 1970, 1, 1, 0, 0, 0, 0
$unixTimeNano = 1631689200000000000
$divToMilli = 1000000

I get exactly what I was expecting “Wednesday, September 15, 2021 7:00:00 AM”

I have no idea why It behaves like this, look like it’s ignoring the provided timestamp completely.
I had a look around and didn’t find any issue that sounds like this one.

@Anaisdg do you have any idea?

I’ve figured it out.
In window period “auto” setting was messing the output visible in Data Explorer.

Anyhow, many thanks for committing your time to look into it.

1 Like