[Logcheck-devel] Shell Expansion in logcheck.logfiles

Florian Mutter elm at skweez.net
Mon Jul 11 13:36:35 UTC 2011


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

I found this old mail and wanted to ask, if there is any plan to include this patch? I think there is also a little bug in the patch. It needs to be 'ls -1 $file' instead of 'ls -1 "$file"'

elm


More information about the Logcheck-devel mailing list