Podman rootless journald logging

journaldpodman

I'm trying to log to the host's systemd-journald from a rootless podman-container.
When i run the container as root with the --privileged flag, i can read the logs from the container on the host with journalctl as expected. However, running the container in rootless mode breaks said logging-functionality (nothing shows up in jornalctl). Is there any way to solve this?

Best Answer

In case your system looks like this

$ grep Storage /etc/systemd/journald.conf 
#Storage=auto
$ ls /var/log/journal
ls: cannot access '/var/log/journal': No such file or directory
$ 

(That seems to be the default for CentOS 8.3)

you could try

sudo mkdir /var/log/journal

and then reboot the computer.

(That solution worked for me on CentOS 8.3)

Explanation

If Storage is set to auto in the file /etc/systemd/journald.conf and the directory /var/log/journal is missing, the journal log data will only be stored in memory.

(auto is also the default in case Storage has not been set in the file /etc/systemd/journald.conf)

See also man journald.conf where this mode is called volatile.

There is a GitHub issue in the Systemd repository with the title Allow users to read their own volatile journals. I would guess that that sudo mkdir /var/log/journal will no longer be needed after that GitHub issue has been fixed.

Related Topic