From owner-freebsd-bugs Thu Apr 6 13:40:07 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id NAA07322 for bugs-outgoing; Thu, 6 Apr 1995 13:40:07 -0700 Received: (from gnats@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id NAA07311 ; Thu, 6 Apr 1995 13:40:04 -0700 Date: Thu, 6 Apr 1995 13:40:04 -0700 Message-Id: <199504062040.NAA07311@freefall.cdrom.com> From: Mark Murray Reply-To: Mark Murray To: freebsd-bugs Subject: conf/301: Log rotation wastes _much_ to much space In-Reply-To: Your message of Thu, 6 Apr 1995 22:37:25 +0200 <199504062037.WAA23356@grunt.grondar.za> Sender: bugs-owner@FreeBSD.org Precedence: bulk >Number: 301 >Category: conf >Synopsis: Log rotation wastes _much_ to much space >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs (FreeBSD bugs mailing list) >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 6 13:40:02 1995 >Originator: Mark Murray >Organization: GTA >Release: FreeBSD 2.1.0-Development i386 >Environment: Just about any FreeBSD >Description: The scripts /etc/weekly and /etc/monthly very kindly keep the logs to managable sizes by truncating/rotating them, and deleting the really old crud. The problem is, these files still waste space. The root parition is usually quite small (on installation one is advised to keep it so), so bunches of these things can be a pain. >How-To-Repeat: Run any FreeBSD system for an appreciable length of time... >Fix: Compress (gzip) the buggers! Here are patches to etc/daily, etc/weekly and etc/monthly to do this job: (please note that you should gzip -9n all your .[0-9]'s before doing this! If you don't, you will just keep forever the old crud. *** daily Wed Mar 1 23:34:58 1995 --- /etc/daily Thu Apr 6 22:32:42 1995 *************** *** 77,93 **** echo "" echo "Rotating mail log:" cd /var/log ! rm -f maillog.7 ! if [ -f maillog.6 ]; then mv -f maillog.6 maillog.7; fi ! if [ -f maillog.5 ]; then mv -f maillog.5 maillog.6; fi ! if [ -f maillog.4 ]; then mv -f maillog.4 maillog.5; fi ! if [ -f maillog.3 ]; then mv -f maillog.3 maillog.4; fi ! if [ -f maillog.2 ]; then mv -f maillog.2 maillog.3; fi ! if [ -f maillog.1 ]; then mv -f maillog.1 maillog.2; fi ! if [ -f maillog.0 ]; then mv -f maillog.0 maillog.1; fi mv -f maillog maillog.0 cp /dev/null maillog chmod 644 maillog kill -1 `cat /var/run/syslog.pid` cd / --- 77,94 ---- echo "" echo "Rotating mail log:" cd /var/log ! rm -f maillog.7.gz ! if [ -f maillog.6.gz ]; then mv -f maillog.6.gz maillog.7.gz; fi ! if [ -f maillog.5.gz ]; then mv -f maillog.5.gz maillog.6.gz; fi ! if [ -f maillog.4.gz ]; then mv -f maillog.4.gz maillog.5.gz; fi ! if [ -f maillog.3.gz ]; then mv -f maillog.3.gz maillog.4.gz; fi ! if [ -f maillog.2.gz ]; then mv -f maillog.2.gz maillog.3.gz; fi ! if [ -f maillog.1.gz ]; then mv -f maillog.1.gz maillog.2.gz; fi ! if [ -f maillog.0.gz ]; then mv -f maillog.0.gz maillog.1.gz; fi mv -f maillog maillog.0 cp /dev/null maillog chmod 644 maillog + gzip -9n maillog.0 kill -1 `cat /var/run/syslog.pid` cd / *** weekly Sun Mar 19 21:35:12 1995 --- etc/weekly Thu Apr 6 22:04:38 1995 *************** *** 45,54 **** echo "Rotating messages:" cd /var/log ! if [ -f messages.2 ]; then mv -f messages.2 messages.3; fi ! if [ -f messages.1 ]; then mv -f messages.1 messages.2; fi ! if [ -f messages.0 ]; then mv -f messages.0 messages.1; fi mv -f messages messages.0 cp /dev/null messages chmod 644 messages kill -1 `cat /var/run/syslog.pid` --- 45,55 ---- echo "Rotating messages:" cd /var/log ! if [ -f messages.2.gz ]; then mv -f messages.2.gz messages.3.gz; fi ! if [ -f messages.1.gz ]; then mv -f messages.1.gz messages.2.gz; fi ! if [ -f messages.0.gz ]; then mv -f messages.0.gz messages.1.gz; fi mv -f messages messages.0 + gzip -9n messages.0 cp /dev/null messages chmod 644 messages kill -1 `cat /var/run/syslog.pid` *************** *** 56,65 **** echo "Rotating cron log:" cd /var/cron ! if [ -f log.2 ]; then mv -f log.2 log.3; fi ! if [ -f log.1 ]; then mv -f log.1 log.2; fi ! if [ -f log.0 ]; then mv -f log.0 log.1; fi mv -f log log.0 cp /dev/null log chmod 600 log cd / --- 57,67 ---- echo "Rotating cron log:" cd /var/cron ! if [ -f log.2.gz ]; then mv -f log.2.gz log.3.gz; fi ! if [ -f log.1.gz ]; then mv -f log.1.gz log.2.gz; fi ! if [ -f log.0.gz ]; then mv -f log.0.gz log.1.gz; fi mv -f log log.0 + gzip -9n log.0 cp /dev/null log chmod 600 log cd / *** monthly Tue Aug 31 18:29:03 1993 --- etc/monthly Thu Apr 6 22:09:15 1995 *************** *** 15,27 **** cd /var/log for i in kerberos.log lpd-errs wtmp; do echo -n " $i" ! if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi ! if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi ! if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi ! if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi ! if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi ! if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi ! if [ -f $i ]; then mv -f $i $i.0; fi >$i done echo "" --- 15,27 ---- cd /var/log for i in kerberos.log lpd-errs wtmp; do echo -n " $i" ! if [ -f $i.5.gz ]; then mv -f $i.5.gz $i.6.gz; fi ! if [ -f $i.4.gz ]; then mv -f $i.4.gz $i.5.gz; fi ! if [ -f $i.3.gz ]; then mv -f $i.3.gz $i.4.gz; fi ! if [ -f $i.2.gz ]; then mv -f $i.2.gz $i.3.gz; fi ! if [ -f $i.1.gz ]; then mv -f $i.1.gz $i.2.gz; fi ! if [ -f $i.0.gz ]; then mv -f $i.0.gz $i.1.gz; fi ! if [ -f $i ]; then mv -f $i $i.0; gzip -9n $i.0; fi >$i done echo "" >Audit-Trail: >Unformatted: Mark Murray