From 7ec97b40d0d500427dd00987b52fb4733ffaad22 Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Fri, 29 Dec 2023 17:00:45 +0200 Subject: [PATCH] journalctl: add "logs from last unit start" example (#11578) Co-authored-by: Starbeamrainbowlabs --- pages/linux/journalctl.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/linux/journalctl.md b/pages/linux/journalctl.md index 166602961..e447ec1df 100644 --- a/pages/linux/journalctl.md +++ b/pages/linux/journalctl.md @@ -7,10 +7,6 @@ `journalctl -b --priority={{3}}` -- Show all messages from last [b]oot: - -`journalctl -b -1` - - Delete journal logs which are older than 2 days: `journalctl --vacuum-time={{2d}}` @@ -23,6 +19,10 @@ `journalctl -u {{unit}}` +- Show logs for a given unit since the last time it started: + +`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})` + - Filter messages within a time range (either timestamp or placeholders like "yesterday"): `journalctl --since {{now|today|yesterday|tomorrow}} --until {{YYYY-MM-DD HH:MM:SS}}`