From 31866bab58020545edc2ff155c483003da93ecd8 Mon Sep 17 00:00:00 2001 From: Gardais Jeremy Date: Tue, 30 Jan 2018 16:48:12 +0100 Subject: [PATCH] Add a ".d" suffix to all olddir directories for logrotate. --- scripts/latecommand/logrotate/aptitude | 11 +- scripts/latecommand/logrotate/dpkg | 33 ++--- scripts/latecommand/logrotate/logrotate.conf | 45 ++---- scripts/latecommand/logrotate/rsyslog | 147 ++++++++++--------- scripts/latecommand/post.sh | 6 +- 5 files changed, 116 insertions(+), 126 deletions(-) diff --git a/scripts/latecommand/logrotate/aptitude b/scripts/latecommand/logrotate/aptitude index 541ce77..a1ad0f5 100644 --- a/scripts/latecommand/logrotate/aptitude +++ b/scripts/latecommand/logrotate/aptitude @@ -1,8 +1,7 @@ /var/log/aptitude { - rotate 6 - monthly - compress - missingok - notifempty - olddir /var/log/aptitude.d + rotate 6 + monthly + missingok + olddir /var/log/aptitude.d + } diff --git a/scripts/latecommand/logrotate/dpkg b/scripts/latecommand/logrotate/dpkg index 4b39ff8..35441a2 100644 --- a/scripts/latecommand/logrotate/dpkg +++ b/scripts/latecommand/logrotate/dpkg @@ -1,21 +1,18 @@ -/var/log/dpkg.log { - monthly - rotate 12 - compress - delaycompress - missingok - notifempty - create 644 root root - olddir /var/log/dpkg +/var/log/alternatives.log { + rotate 12 + monthly + missingok + create 644 root root + olddir /var/log/alternatives.d + } -/var/log/alternatives.log { - monthly - rotate 12 - compress - delaycompress - missingok - notifempty - create 644 root root - olddir /var/log/alternatives +/var/log/dpkg.log { + rotate 12 + monthly + missingok + create 644 root root + olddir /var/log/dpkg.d + } + diff --git a/scripts/latecommand/logrotate/logrotate.conf b/scripts/latecommand/logrotate/logrotate.conf index 5b00ccd..504a88c 100644 --- a/scripts/latecommand/logrotate/logrotate.conf +++ b/scripts/latecommand/logrotate/logrotate.conf @@ -1,44 +1,29 @@ -# see "man logrotate" for details -# rotate log files weekly -weekly -# keep 4 weeks worth of backlogs -rotate 4 - -# create new (empty) log files after rotating old ones create - -# old versions of log files are compressed with gzip +weekly compress - -# compress only from the second log file delaycompress - -# use date as a suffix of the rotated file dateext - -# do not rotate the log if it is empty notifempty - -# packages drop log rotation information into this directory include /etc/logrotate.d -# no packages own wtmp, or btmp -- we'll rotate them here +# No packages own wtmp or btmp, they will be managed directly /var/log/wtmp { - rotate 3 - monthly - missingok - create 0664 root utmp - olddir /var/log/old_logs + missingok + monthly + create 0664 root utmp + rotate 3 + olddir /var/log/old_logs.d + } +# No packages own wtmp or btmp, they will be managed directly /var/log/btmp { - monthly - rotate 3 - missingok - create 0660 root utmp - olddir /var/log/old_logs + missingok + monthly + create 0660 root utmp + rotate 3 + olddir /var/log/old_logs.d + } -# system-specific logs may be configured here -# See /etc/logrotate.d/rsyslog diff --git a/scripts/latecommand/logrotate/rsyslog b/scripts/latecommand/logrotate/rsyslog index 09c1331..89dfbcf 100644 --- a/scripts/latecommand/logrotate/rsyslog +++ b/scripts/latecommand/logrotate/rsyslog @@ -12,59 +12,63 @@ /var/log/local7.log /var/log/uucp.log { - rotate 7 - daily - missingok - olddir /var/log/syslog.d - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript + rotate 8 + daily + missingok + olddir /var/log/syslog.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } -/var/log/cron.log -/var/log/mark.log -{ - maxsize 250k - missingok - sharedscripts - olddir /var/log/cron - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript +/var/log/cron.log /var/log/mark.log { + maxsize 250k + missingok + sharedscripts + olddir /var/log/cron.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } -/var/log/daemon.log -{ - maxsize 250k - missingok - sharedscripts - olddir /var/log/daemon - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript +/var/log/daemon.log { + maxsize 250k + missingok + sharedscripts + olddir /var/log/daemon.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } -/var/log/kern.log -/var/log/kernel.log -{ - maxsize 250k - missingok - sharedscripts - olddir /var/log/kern - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript +/var/log/kern.log /var/log/kernel.log { + maxsize 250k + missingok + sharedscripts + olddir /var/log/kern.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } -/var/log/lpr.log -{ - maxsize 250k - missingok - sharedscripts - olddir /var/log/lpr - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript +/var/log/lpr.log { + maxsize 250k + missingok + sharedscripts + olddir /var/log/lpr.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } /var/log/mail.log @@ -72,36 +76,41 @@ /var/log/mail.warn /var/log/mail.err { - maxsize 250k - missingok - sharedscripts - olddir /var/log/mail - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript + maxsize 250k + missingok + sharedscripts + olddir /var/log/mail.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } /var/log/auth.log /var/log/authpriv.log /var/log/user.log { - maxsize 250k - missingok - sharedscripts - olddir /var/log/auth - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript + maxsize 250k + missingok + sharedscripts + olddir /var/log/auth.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } -/var/log/messages -/var/log/debug -{ - maxsize 250k - missingok - sharedscripts - olddir /var/log/messages.d - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript +/var/log/messages /var/log/debug { + maxsize 250k + missingok + sharedscripts + olddir /var/log/messages.d + + postrotate + invoke-rc.d rsyslog rotate > /dev/null + + endscript } + diff --git a/scripts/latecommand/post.sh b/scripts/latecommand/post.sh index 6ec54da..b03fe3d 100755 --- a/scripts/latecommand/post.sh +++ b/scripts/latecommand/post.sh @@ -91,10 +91,10 @@ cp "${LOGROTATE_APTITUDE_CONF}" "${LOGROTATE_APTITUDE_FILE}" cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}" # Create an archive directory for some log files (aptitude, dpkg,…) -mkdir -p -- /var/log/old_logs /var/log/aptitude.d /var/log/dpkg /var/log/alternatives /var/log/syslog.d /var/log/cron /var/log/daemon /var/log/kern /var/log/lpr /var/log/mail /var/log/auth /var/log/messages.d +mkdir -p -- /var/log/old_logs.d /var/log/aptitude.d /var/log/dpkg.d /var/log/alternatives.d /var/log/syslog.d /var/log/cron.d /var/log/daemon.d /var/log/kern.d /var/log/lpr.d /var/log/mail.d /var/log/auth.d /var/log/messages.d -chmod 0750 /var/log/auth /var/log/daemon /var/log/kern /var/log/messages.d /var/log/syslog.d -chown root:adm /var/log/auth /var/log/daemon /var/log/kern /var/log/messages.d /var/log/syslog.d +chmod 0750 /var/log/auth.d /var/log/daemon.d /var/log/kern.d /var/log/messages.d /var/log/syslog.d +chown root:adm /var/log/auth.d /var/log/daemon.d /var/log/kern.d /var/log/messages.d /var/log/syslog.d # Create the log directory for journald (Systemd), need the configuration Storage=(auto|persistent) mkdir -p -- /var/log/journal