[Logcheck-devel] Bug#412201: [PATCH] Squashed commit of the following:

Micah Anderson micah at debian.org
Sat Aug 25 02:02:23 UTC 2007


commit 81496d0cf7b161bf981d51f0b96f860d68f3f6e3
Author: Micah Anderson <micah at debian.org>
Date:   Fri Aug 24 17:51:31 2007 -0400

    Enable alternate temporary directory to be set in the configuration file

    On servers where the logfiles are very large and grow quickly, the
    logcheck processes may run into space issues in /tmp resulting in the
    email such as the following to be sent:

    cp: writing `/tmp/logcheck.y12449/checked': No space left on device
    /usr/sbin/logcheck: line 161: cannot create temp file for here document: No space left on device
    mail: /tmp/mail.RsXXXXpc2eAx: No space left on device
    Null message body; hope that's ok

    Followed by an empty email.

    This is not good because of a few reasons:

    1. /tmp fills up temporarily, other problems can result from this
    2. You loose logcheck for this run

    Although logcheck falls back to /var/tmp if it cannot create a directory in /tmp,
    it doesn't allow the admin to set a temporary directory other than /tmp if this
    condition presents itself.

    The solution is simple, the attached patch adds a new configuration to
    /etc/logcheck/logcheck.conf for a TMP variable, sets it to be default
    what logcheck uses now (/tmp) and alters the logcheck executable to honor this
    variable when set.
---
 etc/logcheck.conf |   12 ++++++++++++
 src/logcheck      |    2 +-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/etc/logcheck.conf b/etc/logcheck.conf
index 2d2c378..c8a823d 100644
--- a/etc/logcheck.conf
+++ b/etc/logcheck.conf
@@ -63,3 +63,15 @@ FQDN=1
 # Controls [logcheck] prefix on Subject: lines
 
 # ADDTAG="no"
+
+# Set a different location for temporary files than /tmp
+# this is useful if your /tmp is small and you are getting
+# errors such as:
+# cp: writing `/tmp/logcheck.y12449/checked': No space left on device
+# /usr/sbin/logcheck: line 161: cannot create temp file for here document: No space left on device
+# mail: /tmp/mail.RsXXXXpc2eAx: No space left on device
+# Null message body; hope that's ok
+# 
+# If this is happening, likely you will want to change the following to be some other 
+# location, such as /var/tmp
+TMP="/tmp"
diff --git a/src/logcheck b/src/logcheck
index abb33f9..e0c907a 100755
--- a/src/logcheck
+++ b/src/logcheck
@@ -619,7 +619,7 @@ else
 fi
 
 # Create the secure temporary directory or exit
-TMPDIR=$(mktemp -d -p /tmp logcheck.XXXXXX) \
+TMPDIR=$(mktemp -d -p $TMP logcheck.XXXXXX) \
     || TMPDIR=$(mktemp -d -p /var/tmp logcheck.XXXXXX) \
     || error "Could not create temporary directory"
 
-- 
1.5.2.4






More information about the Logcheck-devel mailing list