On my system
/var/log is on ramdisk in order to avoid writes to my SD card. By default, the Home Assistant container writes logs to
/etc/homeassistant/home-assistant.log, that’s nonstandard and incorrect on Linux systems.
One can redirect the log file like this:
systemd-tmpfilesknow that Home Assistant needs a folder in
/var/logon each boot. Open
/etc/tmpfiles.d/home-assistant.confand add these line, save it:
d /var/log/homeassistant 0755 root root - - f /etc/homeassistant/home-assistant.log 0644 root root - -
Create the container with the log mounted into the correct location, the important addition is
If you haven’t yet instructed
/var/log/homeassistant/homeassistant.logmake sure to do it manually, otherwise Docker will try to be smart and create
homeassistant.logas a directory .
sudo docker run --init -d --name="home-assistant" -e "TZ=[your timezone]" -v /etc/homeassistant:/config -v /var/log/homeassistant/home-assistant.log:/config/home-assistant.log [fill in the rest according to your container configuration and the documentation]
(Before you ask, no, just a symlink from
/var/log doesn’t work)
If you haven’t, you probably also wish to instruct Docker to use
rsyslog as its logging destination, Docker too creates its own log file.