brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl since ActiveEnterTimestamp shows logs from the last service start

Journalctl
~/tips/tip-journalctl-since-start

journalctl -u nginx --since "$(systemctl show -p ActiveEnterTimestamp --value nginx)"

Read only the log lines since a service last started, without looking up the time.

After a restart I only care about what happened since the service came up. systemd knows that moment, and journalctl accepts its time format directly.

Ask systemctl for the timestamp and feed it to --since:

journalctl -u nginx --since "$(systemctl show -p ActiveEnterTimestamp --value nginx)"

systemctl show prints something like Mon 2026-11-30 15:11:00 UTC, and journalctl parses that as is. The result starts with the Starting and Started lines of that run and nothing older.

As a shell function it becomes a short command:

sincestart() { journalctl -u "$1" --since "$(systemctl show -p ActiveEnterTimestamp --value "$1")"; }
sincestart nginx

The timestamp has only whole seconds, so lines from earlier in that same second come along too. And if the service has never been active, the value is empty and --since "" fails, so check systemctl is-active first in a script.

Newer systemd releases have journalctl -u nginx -I, which does something similar through the invocation ID. The timestamp version works on older systems too, and the same trick with InactiveEnterTimestamp gives you the time a service stopped.

Further reading: journalctl man page, systemctl man page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link