Logfile Timestamp incorrect by 4 hours - Docker

HI All

I’m using homeassistant in a docker container. The timezone is specified in my configuration file, the host machines timezone is correct (verified by typing “date”) and the containers timezone is correct (but connecting to it via bash and typing “date”) but my timestamped log files are off by 4 hours. Does anyone have an idea of how to fix it? All of my automations run at the correct time (based in NodeRed) but it seems like the only thing thats incorrect is my log file.

Thanks!

1 Like

What timezone is in your home assistant configuration.yaml?

I’ve always noticed the same thing. All timestamp and time/date displays are accurate and local… except for the system log, which appears to be Zulu (GMT). Yes, I’ve set mine for US Central Time Zone.

HA works in UTC, and all log files are recorded as this. The local timezone is only taken in to account when displaying on a gui.

What is the reason for that? It makes error tracking more complicated if you need to remember to recalculate the time. Or prove when an alarm went off

Mine isn’t. My most recent entry starts:

2018-10-16 17:44:12

Which is the time right now.

Interesting, how are you running HA?

Ubuntu server 18.04 with home assistant installed in a venv per these instructions:

There must be something in your environment that persuades HA to adjust the time.

I have a virtualbox vm set up like that for testing. I can’t remember noticing about the log file times in that so I’ll have to check when I get to my computer.

It would be interesting to know how HA know what is the UTC time. Btw my logs show correct time. I run Debian and Docker

Computers run in UTC all the time.

So how can my comuter set to gmt +2 know what the utc time is? No internet connection

Computers can subtract 2.

From what?

To clarify. Today I will unpack and install a new nuc for my neighbor to be used for HA. It has never and will never be connected to internet. UTC was created to sync computer times over the internet. But how can the new nuc be using utc?

UTC is just a timezone. It was formerly known as GMT (Greenwich Mean Time). I think UTC is probably a French acronym.

I haven’t done it for a long time, but if your computer can’t connect to the internet when it is set up, it should ask for the local time and use that. Obviously, from the local time and timezone it can compute the UTC time.

Ok agree. But ha hardly bother about to recalculate the local time set everywhere

What?

You make no sense.

Perhaps because English is not my native language. But what I mean is why should HA use utc time if local time is set. Someone stated that logs always are utc

Your computer uses UTC internally even when you have set it to display the time in another timezone.