Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2003 19:38:58 +0100
From:      Stefan Esser <se@freebsd.org>
To:        current@FreeBSD.org
Subject:   Periodic scripts ignore bzip2ed log files
Message-ID:  <20030105183858.GA9274@StefanEsser.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
When newsyslog.conf was modified to compress rotated log files with bzip2
instead of gzip some 3 months ago, most of the periodic scripts that process 
those log files were not tought how to decompress those archived files.

This affects the following scripts:
        etc/periodic/daily/470.status-named
        etc/periodic/security/800.loginfail
        etc/periodic/security/900.tcpwrap

The result is incomplete processing of log files and possibly the loss
of important warnings that else might have been generated.

In case there are no objections, I intend to commit the following patches
(which should be merged to 5.0R before the release, IMHO).

Regards, STefan

Index: etc/periodic/daily/470.status-named
===================================================================
RCS file: /usr/cvs/src/etc/periodic/daily/470.status-named,v
retrieving revision 1.4
diff -u -r1.4 470.status-named
--- etc/periodic/daily/470.status-named	7 Dec 2002 23:37:44 -0000	1.4
+++ etc/periodic/daily/470.status-named	4 Jan 2003 17:33:00 -0000
@@ -14,7 +14,13 @@
 catmsgs() {
 	find /var/log -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f /var/log/messages ] && cat /var/log/messages
 }
 
Index: etc/periodic/security/800.loginfail
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/800.loginfail,v
retrieving revision 1.4
diff -u -r1.4 800.loginfail
--- etc/periodic/security/800.loginfail	24 Sep 2002 18:53:46 -0000	1.4
+++ etc/periodic/security/800.loginfail	4 Jan 2003 17:33:15 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'auth.log.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/auth.log ] && cat $LOG/auth.log
 }
 
Index: etc/periodic/security/900.tcpwrap
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/900.tcpwrap,v
retrieving revision 1.2
diff -u -r1.2 900.tcpwrap
--- etc/periodic/security/900.tcpwrap	24 Sep 2002 18:53:46 -0000	1.2
+++ etc/periodic/security/900.tcpwrap	4 Jan 2003 17:33:38 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/messages ] && cat $LOG/messages
 }
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030105183858.GA9274>