Show journald logs from last service start - systemd InvocationID
Show only journal logs from last
I needed to test something and was only interested in the logs since the last start/restart of a service. For this, you can use the systemd invocation id from a systemd service.
You can check the current systemd invocation id like so:
systemctl show -p InvocationID --value kubelet.service
Then just use the _SYSTEMD_INVOCATION_ID
option in journalctl
to only see logs from the last service start:
journalctl -u kubelet.service _SYSTEMD_INVOCATION_ID="$(systemctl show -p InvocationID --value kubelet.service)"
Have fun!