Why service use UTC in db and log use local timezone

Julia Kreger juliaashleykreger at gmail.com
Tue Aug 8 20:24:06 UTC 2023


Clients can be anywhere, and you don't want them to have to be aware of the
remote server local time zone to have to translate that  to UTC or to your
own local time zone. Everything being in UTC aids that because if you need
to convert it to your local time, you only have the single offset to be
aware of to put into your context. Mix in clients in different time zones,
and standardizing on something such as UTC is critical.

Logging, realistically should just be an artifact of the localtime set on
the machine when the process launches, and that is typically set for humans
to relate it to their own local time.

Hope that makes sense,

-Julia

On Tue, Aug 8, 2023 at 12:34 PM kaqiu pi <thremes172 at gmail.com> wrote:

> Hello,
>
> I have a openstack cluster. And the local time of server is different from
> UTC.
>
> I saw that the log date of openstack service is local time. But when I
> use the command line to query the openstack service status, time zone is
> UTC. Such as `opentack compute service list`, "Update At" is UTC.
>
> In the email archive[1], I saw that there was a discussion earlier:
> > i would guess it a deliberate design descisn to only store data
> information in utc format and leave it to the clinets to convert to local
> timezones if desired
>
> But at that time it was just a guess, I would like to ask if this is the
> meaning of the original design, why the service use UTC instead of local
> time?
>
> I would appreciate any kind of guidance or help.
> Best wishes.
>
>
> [1]
> https://lists.openstack.org/pipermail/openstack-discuss/2021-June/022857.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20230808/e559daeb/attachment-0001.htm>


More information about the openstack-discuss mailing list