From 87c3285df66a40067209068926196c6c8a959509 Mon Sep 17 00:00:00 2001 From: ilyam8 Date: Thu, 23 Nov 2023 14:29:47 +0200 Subject: [PATCH 1/3] journalctl: add "logs from last unit start" example --- pages/linux/journalctl.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pages/linux/journalctl.md b/pages/linux/journalctl.md index 1666029611..eef1897594 100644 --- a/pages/linux/journalctl.md +++ b/pages/linux/journalctl.md @@ -34,3 +34,7 @@ - Show all messages by a specific executable: `journalctl {{path/to/executable}}` + +- Show logs from last unit start: + +`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})` From 0a5c8e2f332071e11e5c549ed77edc363f4cff3e Mon Sep 17 00:00:00 2001 From: ilyam8 Date: Tue, 28 Nov 2023 12:39:51 +0200 Subject: [PATCH 2/3] remove "Show all messages from last [b]oot" example --- pages/linux/journalctl.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pages/linux/journalctl.md b/pages/linux/journalctl.md index eef1897594..2ce23c91e5 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 from last unit start: + +`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}}` @@ -34,7 +34,3 @@ - Show all messages by a specific executable: `journalctl {{path/to/executable}}` - -- Show logs from last unit start: - -`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})` From b0f2317abe8ad8e4a7259058595b4294f3e1b9e3 Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Sun, 3 Dec 2023 00:08:57 +0200 Subject: [PATCH 3/3] Update pages/linux/journalctl.md Co-authored-by: Starbeamrainbowlabs --- pages/linux/journalctl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/linux/journalctl.md b/pages/linux/journalctl.md index 2ce23c91e5..e447ec1dff 100644 --- a/pages/linux/journalctl.md +++ b/pages/linux/journalctl.md @@ -19,7 +19,7 @@ `journalctl -u {{unit}}` -- Show logs from last unit start: +- Show logs for a given unit since the last time it started: `journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})`