'created' attribute in logging is overloaded; is sometimes a duration (integer), sometimes a date field
Summary
The 'created' field in the docker-machine log output has variable content types (sometimes an integer, sometimes a date) which makes it challenging to ingest into the likes of Elasticsearch. Ideally, it would be one or the other (or one of the types be changed to another name)
Steps to reproduce
Run the docker+machine executor, with the JSON logs output via whatever path you like into Elasticsearch (as we do for gitlab.com). Observe mapper parsing exceptions from whatever is ingesting into Elasticsearch, and type conflicts in the index view of kibana; the first type for a given index (usually a 'day') wins for that day, and all logs with the other type will be rejected/dropped.
Actual behavior
created field has two possible types
Expected behavior
Any given logging field has only one type
Relevant logs and/or screenshots
{"created":101064189921,"level":"warning","msg":"Requesting machine removal","name":"runner-ed2dce3a-srm-1558310245-4b5c9fb0","now":"2019-05-19T23:59:06.536932943Z","reason":"Too many builds","used":5704,"usedCount":1,"tag":"runner","environment":"<redacted>","hostname":"<redacted>","fqdn":"<redacted>"}
vs
{"created":"2019-05-22T04:06:31.944943606Z","docker":"tcp://<redacted>:2376","job":216920852,"level":"info","msg":"Starting docker-machine build...","name":"runner-ed2dce3a-srm-1558497991-83f51c6a","now":"2019-05-22T04:07:32.713608266Z","project":12455841,"runner":"ed2dce3a","time":"2019-05-22T04:07:32Z","usedcount":1}
Environment description
N/A
Used GitLab Runner version
Version: 11.11.0-rc2 Git revision: 7f58b1ec Git branch: 11-11-stable GO version: go1.8.7 Built: 2019-05-06T08:00:18+0000 OS/Arch: linux/amd64
Solution
Seems to come down to a proper date/time value from executors/docker/machine/provider.go:41 (Created: time.Now()
, which is used in executors/docker/machine/executor.go:41 as the 'created' field), vs a duration (integer) from executors/docker/machine/details.go:69 (time.Since(m.Created)
).
I'll submit an MR shortly with my suggestion for resolving this.