1

I store reports from nodes in puppetdb. I want to check time when reports received from specific node via the following query:

curl -sk http://pdb:8080/v3/reports --data-urlencode 'query=["=", "certname", "host.mydomain.com"]' | grep "receive-time"

i get the following output:

"receive-time" : "2015-12-05T11:57:13.882Z",
"receive-time" : "2015-12-05T11:46:26.826Z",
"receive-time" : "2015-12-05T11:17:15.702Z",
"receive-time" : "2015-12-05T13:13:56.060Z",

So i can conclude that i have 4 reports from 09:32:15 until 11:32:13. and this is wrong ( offset of 2 hours )

At other hand when i query postgresdb backend directly via

select certname,puppet_version,start_time, status_id from reports where certname = 'host.mydomain.com' order by start_time desc; i get different times:

 host.mydomain.com | 3.8.1   | 2015-12-05 13:57:07.079+02 |    2
 host.mydomain.com | 3.8.1   | 2015-12-05 13:46:19.658+02 |    2
 host.mydomain.com | 3.8.1   | 2015-12-05 13:17:07.056+02 |    2
 host.mydomain.dom | 3.8.1   | 2015-12-05 13:13:56.608+02 |    2

And these are correct times for reports. All settings for server timezone where puppetdb runs are correct. All settings for postgresdb are set to the same timezone.

How can i make query via curl report correct time please ?

1 Answers1

1

The capital Z after a time-stamp such as 2015-12-05T11:32:13.718Z stands for Zulu time, UTC.

The other time stamp 2015-12-05 13:57:07.079+02 with the +2 is the time corrected for your local time zone, two hours ahead of UTC.

So they are both correct in the absolute sense, but you need to add two hours to a time-stamp in UTC to match with your watch.

HBruijn
  • 84,206
  • 24
  • 145
  • 224