[Logcheck-devel] Shell Expansion in logcheck.logfiles

Jeff Jansen bamakojeff at gmail.com
Wed Jan 30 02:02:01 UTC 2008


I'm running logcheck on a machine hosting a bunch of virtual machines using
vserver, so I'd like to expand shell wildcards in the "logcheck.logfiles"
file.  So instead of entering

/var/lib/vservers/v1/var/log/syslog
/var/lib/vservers/v2/var/log/syslog
/var/lib/vservers/v2/var/log/syslog

I can enter

/var/lib/vservers/*/var/log/syslog

which gets expanded to the same thing as above.  And this way as I add new
virtual machines, their logs get picked up automatically by logcheck.

To that end I patched the logcheck script as follows

--- logcheck.orig       2008-01-30 09:31:48.000000000 +0800
+++ logcheck    2008-01-30 09:33:17.000000000 +0800
@@ -665,7 +665,9 @@
     || error "Could not mkdir for log files"
 if [ ! $LOGFILE ] && [ -r $LOGFILES_LIST ]; then
     for file in $(egrep --text -v "(^#|^[[:space:]]*$)" $LOGFILES_LIST); do
-       logoutput "$file"
+       for line in $(ls -1 "$file"); do
+               logoutput "$line"
+       done
     done
 elif [ $LOGFILE ]; then
     if [ -f $LOGFILE ] && [ -r $LOGFILE ]; then

Anyone see any ways that this is going to come back to haunt me?  It seems
to be working fine, but I've thought that before about "great" ideas I've
had, so... :-)

TIA

Jeff Jansen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/logcheck-devel/attachments/20080130/8515bb4b/attachment.htm 


More information about the Logcheck-devel mailing list