Trailing zeros are added to timestamp

Hi there,

I got some strange issue with xml parsing in telegraf 1.23.4.

I have an XML File with a timestamp in it like this


to parse this field I set in my telegraf config:

timestamp = “//@timestamp
timestamp_format = “unix”

My usual output is outputs.prometheus and strangly in the output I get the timestamp added with trailing “000”

xxx_SVC_wq{cluster=“svc”,host=“hostname”,id=“svc-01-1”} 15404 1661517236000

During the Import Prometheus denies the Import because the date is (for sure) out of bounds.

So I tried outputs.file so see if this makes any difference - and it does - even more zeroes are added:

xxx_SVC,cluster=svc-01,host=hostname,id=svc-01-1 ro=41912,rb=192810950,wb=162441616,re=12,we=11126,rq=551,wq=15404,wo=43603 1661517236000000000

Next up I added three leading 0 to my XML file like this because I thought it might be some issue with the number of digits.


nonetheless in outputs.prometheus the leading 0 are being ommited and once again I get three trailing 0 like this:


Does anyone have a hint for me how I can make telegraf stop adding those “0” ?

Bye, Dirk


Can you share your full config and maybe a sample XML?


When using the file output timestamps are printed with nanosecond precision, so that is why this has the additional zeros.