[Logcheck-devel] Bug#616103: logcheck: (re)enable globbing of logfile names

Casper Gielen C.Gielen at uvt.nl
Wed Mar 2 14:45:41 UTC 2011


Package: logcheck
Version: 1.3.13
Severity: minor
Tags: patch


In Lenny it was possible to use wildcards in logcheck.logfiles. For
example, I used: /var/log/HOSTS/*/*.log

root at durer:~# su -s /bin/bash -c "bash -x /usr/sbin/logcheck" logcheck 
<cut>
+ read file
+ logoutput '/var/log/HOSTS/*/*.log'
+ file='/var/log/HOSTS/*/*.log'
+ debug 'logoutput called with file: /var/log/HOSTS/*/*.log'
+ '[' 0 -eq 1 ']'
+ '[' -f '/var/log/HOSTS/*/*.log' ']'
+ echo 'E: File could not be read: /var/log/HOSTS/*/*.log'
<cut>

The wildcards in the path are not expanded. I've attached a patch that does so.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=nl_NL.UTF-8, LC_CTYPE=nl_NL.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to nl_NL.UTF-8)
Shell: /bin/sh linked to /bin/bash
-------------- next part --------------
--- logcheck	2010-09-03 10:25:15.000000000 +0200
+++ /usr/sbin/logcheck	2011-03-02 15:39:49.097878736 +0100
@@ -436,6 +436,12 @@
     fi
 }
 
+# Expand wildcards
+# eg: /dev/n*ll -> /dev/null
+glob() {
+    xargs -i ls {}
+}
+
 # Show all the cli options to our users.
 usage() {
     debug "usage: Printing usage and exiting"
@@ -658,7 +664,7 @@
 mkdir "$TMPDIR/logoutput" \
     || error "Could not mkdir for log files"
 if [ ! "$LOGFILE" ] && [ -r "$LOGFILES_LIST" ]; then
-    egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST" | while read file; do
+    egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST" | glob | while read file; do
 	logoutput "$file"
     done
 elif [ "$LOGFILE" ]; then


More information about the Logcheck-devel mailing list