From 71a787b9a0b46ac2ec9bef5377ef23ddc091c7f3 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Thu, 12 Oct 2023 14:57:59 +0200 Subject: [PATCH] add sudo --- check_journallog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check_journallog b/check_journallog index 5f85292..15e76b7 100755 --- a/check_journallog +++ b/check_journallog @@ -5,6 +5,7 @@ # # requirements: # - journalctl +# - sudo permissions to journalctl to fetch all lines of all units # # ---------------------------------------------------------------------- # 2023-10-12 v0.1 <axel.hahn@unibe.ch> initial version @@ -89,7 +90,7 @@ if [ -z "$lastLine" ]; then else ts=$( cut -f 1-3 -d " " <<< "$lastLine" ) typeset -i iAge; iAge=$( ph.getFileAge "$tmpfile" ) - data=$( journalctl --since "$ts" ) + data=$( sudo journalctl --since "$ts" ) # for next run: insert last handled line tail -1 <<< "$data" > "$tmpfile" @@ -119,7 +120,7 @@ else test $iCriticalLimit -gt 0 || sLimits+="No critical level " echo "Limits: $sLimits" - # echo "Found $iLines new line(s) in the last $iAge sec" + echo "Raw data: Found $iLines new line(s) in the last $iAge sec" fi -- GitLab