How to allow a user to use journalctl to see user-specific systemd service logs?
On older systemd versions, you'll have to use journalctl --user --user-unit=SERVICENAME
(on newer versions journalctl --user -u SERVICENAME
will work fine).
However, this only works if the Storage
directive of the [Journal]
section of /etc/systemd/journald.conf
is set to persistent
(instead of auto
or volatile
). Reboot after editing the configuration file and the user will be able to see the journal.
More information: https://www.freedesktop.org/software/systemd/man/journald.conf.html https://lists.freedesktop.org/archives/systemd-devel/2016-October/037554.html
I was not able to make it work with the --user
and other such options. However, I can see the data when I use journalctl
on its own. It includes all the logs, though. I can search the specific app I'm interested in and look at that output. To find the latest, I first go at the end of the file then search backward:
-
Hit G to go to the end (it's a capital
G
) -
Hit ? and enter your apps name
It's not as practical, but on the device on which I work (a Jetson), that was pretty much the only way I found to make it work.