Reputation: 176
Docker system with logging driver set to json-file.
I start my container with a TZ environment variable to set my app's time zone. However, the logs are generated with two timestamps. One in the "log" field is set by the application (it seems), and that's correct. Another timestamp is added in a "time" field and that is set to UTC. Any idea how to set the time zone in the "time" field?
{"log":"[2021-10-26T10:25:16+02:00] @DEBUG Ita singillatim piae gaudium falsissime habitaret fama. 3483 ::0.547919\n","stream":"stdout","time":"2021-10-26T08:25:16.251790686Z"}
{"log":"[2021-10-26T10:25:17+02:00] @INFO Inveniret cura aut, grave miseros. 3484 ::0.286877\n","stream":"stdout","time":"2021-10-26T08:25:17.252317279Z"}
Upvotes: 1
Views: 330
Reputation: 66
Docker timestamps it's logs in UTC by default. I don't think there is a option to change this.
https://github.com/docker/cli/issues/604
It is a best practice to log in UTC and then convert to the whichever TZ is required.
Upvotes: 1