Florian Mutter
2011-Jul-11 13:36 UTC
[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 JansenI 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
Hannes von Haugwitz
2011-Jul-11 17:08 UTC
[Logcheck-devel] Shell Expansion in logcheck.logfiles
On Mon, Jul 11, 2011 at 03:36:35PM +0200, Florian Mutter wrote:> Jeff Jansen bamakojeff at gmail.com Wed Jan 30 02:02:01 UTC 2008: > > [...] > > 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"'See #616103[0] (fixed in d076526[1]). Greetings Hannes [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=616103 [1] http://anonscm.debian.org/gitweb/?p=logcheck/logcheck.git;a=commit;h=d076526