Parcourir la source

Merge branch 'tsadpbb-check-log-filling-temp'

Sebastian Wolf il y a 2 ans
Parent
commit
0c9b4e272e
2 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 1 0
      NEWS
  2. 2 1
      plugins-scripts/check_log.sh

+ 1 - 0
NEWS

@@ -2,6 +2,7 @@ This file documents the major additions and syntax changes between releases.
 
 2.4.6 2023-08-01
 	FIXES
+	check_log: Fixed issue where /tmp directory would fill with unnecessary information (#724)
 	check_mailq: Correctly handle "Mail queue is empty" when monitoring Postfix over SSMTP (#611)
 	check_oracle: Reduce false positives when looking for "OK" messages (#723)
 	utils: Fix compiler warnings (#583, #637)

+ 2 - 1
plugins-scripts/check_log.sh

@@ -206,7 +206,6 @@ fi
 if [ ! -d "$TMPDIR" ];then
 	TMPDIR="/tmp"
 fi
-echo "$TMPDIR"
 
 # Copy the logfile to a temporary file, to prevent diff from
 # never finishing when $logfile continues to be written to
@@ -258,6 +257,8 @@ lastentry=$(egrep "$query" "$tempdiff" | tail -1)
 
 rm -f "$tempdiff"
 cat "$logfile" > "$oldlog"
+# Need to remove the temp file otherwise it just fills up the temp directory
+rm -f "$templog"
 
 if [ "$count" = "0" ]; then # no matches, exit with no error
     echo "Log check ok - 0 pattern matches found|match=$count;;;0"