[Logcheck-devel] Bug#270455: logcheck: Add Hostname as a config option

Joerg Jaspert joerg at debian.org
Tue Sep 7 13:28:38 UTC 2004


Package: logcheck
Severity: wishlist

Hi

Pasted below is a small diff that lets you set the hostname for the mail
with a switch on the commandline. Helps in system where a central log host
gets the logs for all hosts.

PS: It would be very helpful if logcheck is able to expand variables in the
logfile names.
For example: DATE=`date -d today "+/%Y/%m/%d"`
Filename: /var/log/hosts/foo/${DATE}/syslog

Helps with systems that sort the logfiles in daily subdirs (the easiest logrotating
you can have).

bye
JJ

--- /usr/sbin/logcheck.orig	2004-09-07 15:17:37.000000000 +0200
+++ /usr/sbin/logcheck	2004-09-07 15:24:33.000000000 +0200
@@ -39,7 +39,7 @@
 ATTACK=0
 
 # Set the getopts string
-GETOPTS="c:dhl:L:m:opr:RsS:tTuvw"
+GETOPTS="c:dhl:L:m:opr:RsS:tTuvwH:"
 
 # Get the details for the email message
 # Hostname either fully qualified or not.
@@ -432,6 +432,7 @@
  -u           = enable syslog-summary
  -v           = print version
  -w           = runlevel "workstation"
+ -H	      = set Hostname for the mail subjects
 EOF
 }
 
@@ -543,6 +544,9 @@
 	    debug "Setting REPORTLEVEL to workstation"
 	    REPORTLEVEL="workstation"
 	    ;;
+	H)  debug "Setting HOSTNAME to $OPTARG"
+	    HOSTNAME="$OPTARG"
+	    ;;
 	\?)
 	    usage
 	    exit 1






More information about the Logcheck-devel mailing list