Currently, home-assistant.log
shows the local timestamp for log entries without a timezone offset. This is problematic for utilities that need to read the logs, like fail2ban. You can hard-code an offset in those utilities, but it breaks every time local time changes due to daylight savings.
Including the timezone offset would solve this issue, and also make the logging more precise, which is helpful when examining logs during a time change.
After looking at the code, I believe this could be as simple as modifying const.py, line 1119 from this:
FORMAT_TIME: Final = "%H:%M:%S"
to this:
FORMAT_TIME: Final = "%H:%M:%S %z"
As far as I can tell, that constant is used to set FORMAT_DATETIME
, which is used in bootstrap.py to set up the logging instance.
Additionally, both FORMAT_TIME
and FORMAT_DATETIME
are used in core/tests/components/input_datetime/test_init.py at ac2090d2f5e753bba5849c9037ab54e7442b9983 · home-assistant/core · GitHub
I’m not certain, but I think those are unit tests that don’t have an impact on functionality.
Please let me know if this is not a reasonable request for some reason.
Thanks for your time!