Been doing some digging to parse GCE Operations logs to setup an alert for a specific kind of error (Google's own Stackdriver doesn't do this yet :( btw).
There are 3 timestamps for each GCE operation in the JSON output: "startTime", "insertTime" and "endTime". I.E.
[
{
"endTime": "2016-04-19T10:28:45.608-07:00",
"id": "5755718700018501968",
"insertTime": "2016-04-19T10:28:31.130-07:00",
"kind": "compute#operation",
"name": "operation-1461086910672-530d9ce4bec81-ad2b5000-ffce4eca",
"operationType": "attachDisk",
"progress": 100,
"startTime": "2016-04-19T10:28:31.731-07:00",
"status": "DONE",
"targetId": "3038880116613312000",
"targetLink": "us-central1-a/instances/gke-default-pool-ed45ed8f-0000",
},
{
"endTime": "2016-04-19T17:47:37.201-07:00",
"error": {
"errors": [
{
"code": "RESOURCE_IN_USE_BY_ANOTHER_RESOURCE",
"message": "The disk resource 'events-data' is already being used by 'gke-default-pool-aaaaaaaa-e8a6'"
}
]
},
"httpErrorMessage": "BAD REQUEST",
"httpErrorStatusCode": 400,
"id": "8297339586493500000",
"insertTime": "2016-04-19T17:47:35.086-07:00",
"kind": "compute#operation",
"name": "operation-1461113254565-530dff083d489-e34e0000-b9d7faa2",
"operationType": "attachDisk",
"progress": 100,
"startTime": "2016-04-19T17:47:35.648-07:00",
"status": "DONE",
"targetId": "7950175172344672000",
"targetLink": "us-central1-a/instances/gke-default-pool-aaaaaaaa-u4dd",
}
]
Does anyone know what each of those timestamps are? It's probably easier to understand the startTime, and endTime, but what is insertTime?
Also, it seems that timestamps are all represented in local time (with a timezone offset) instead of using UTC (best practice).
This is a major annoyance as from local time -> UTC conversion are cumbersome and error-prone. [1][2]