Add a ".d" suffix to all olddir directories for logrotate.

This commit is contained in:
Jeremy Gardais 2018-01-30 16:48:12 +01:00
parent 7436979bb1
commit 31866bab58
5 changed files with 116 additions and 126 deletions

View File

@ -1,8 +1,7 @@
/var/log/aptitude { /var/log/aptitude {
rotate 6 rotate 6
monthly monthly
compress missingok
missingok olddir /var/log/aptitude.d
notifempty
olddir /var/log/aptitude.d
} }

View File

@ -1,21 +1,18 @@
/var/log/dpkg.log { /var/log/alternatives.log {
monthly rotate 12
rotate 12 monthly
compress missingok
delaycompress create 644 root root
missingok olddir /var/log/alternatives.d
notifempty
create 644 root root
olddir /var/log/dpkg
} }
/var/log/alternatives.log { /var/log/dpkg.log {
monthly rotate 12
rotate 12 monthly
compress missingok
delaycompress create 644 root root
missingok olddir /var/log/dpkg.d
notifempty
create 644 root root
olddir /var/log/alternatives
} }

View File

@ -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 create
weekly
# old versions of log files are compressed with gzip
compress compress
# compress only from the second log file
delaycompress delaycompress
# use date as a suffix of the rotated file
dateext dateext
# do not rotate the log if it is empty
notifempty notifempty
# packages drop log rotation information into this directory
include /etc/logrotate.d 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 { /var/log/wtmp {
rotate 3 missingok
monthly monthly
missingok create 0664 root utmp
create 0664 root utmp rotate 3
olddir /var/log/old_logs olddir /var/log/old_logs.d
} }
# No packages own wtmp or btmp, they will be managed directly
/var/log/btmp { /var/log/btmp {
monthly missingok
rotate 3 monthly
missingok create 0660 root utmp
create 0660 root utmp rotate 3
olddir /var/log/old_logs olddir /var/log/old_logs.d
} }
# system-specific logs may be configured here
# See /etc/logrotate.d/rsyslog

View File

@ -12,59 +12,63 @@
/var/log/local7.log /var/log/local7.log
/var/log/uucp.log /var/log/uucp.log
{ {
rotate 7 rotate 8
daily daily
missingok missingok
olddir /var/log/syslog.d olddir /var/log/syslog.d
postrotate
invoke-rc.d rsyslog rotate > /dev/null postrotate
endscript invoke-rc.d rsyslog rotate > /dev/null
endscript
} }
/var/log/cron.log /var/log/cron.log /var/log/mark.log {
/var/log/mark.log maxsize 250k
{ missingok
maxsize 250k sharedscripts
missingok olddir /var/log/cron.d
sharedscripts
olddir /var/log/cron postrotate
postrotate invoke-rc.d rsyslog rotate > /dev/null
invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
/var/log/daemon.log /var/log/daemon.log {
{ maxsize 250k
maxsize 250k missingok
missingok sharedscripts
sharedscripts olddir /var/log/daemon.d
olddir /var/log/daemon
postrotate postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript
endscript
} }
/var/log/kern.log /var/log/kern.log /var/log/kernel.log {
/var/log/kernel.log maxsize 250k
{ missingok
maxsize 250k sharedscripts
missingok olddir /var/log/kern.d
sharedscripts
olddir /var/log/kern postrotate
postrotate invoke-rc.d rsyslog rotate > /dev/null
invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
/var/log/lpr.log /var/log/lpr.log {
{ maxsize 250k
maxsize 250k missingok
missingok sharedscripts
sharedscripts olddir /var/log/lpr.d
olddir /var/log/lpr
postrotate postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript
endscript
} }
/var/log/mail.log /var/log/mail.log
@ -72,36 +76,41 @@
/var/log/mail.warn /var/log/mail.warn
/var/log/mail.err /var/log/mail.err
{ {
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/mail olddir /var/log/mail.d
postrotate
invoke-rc.d rsyslog rotate > /dev/null postrotate
endscript invoke-rc.d rsyslog rotate > /dev/null
endscript
} }
/var/log/auth.log /var/log/auth.log
/var/log/authpriv.log /var/log/authpriv.log
/var/log/user.log /var/log/user.log
{ {
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/auth olddir /var/log/auth.d
postrotate
invoke-rc.d rsyslog rotate > /dev/null postrotate
endscript invoke-rc.d rsyslog rotate > /dev/null
endscript
} }
/var/log/messages /var/log/messages /var/log/debug {
/var/log/debug maxsize 250k
{ missingok
maxsize 250k sharedscripts
missingok olddir /var/log/messages.d
sharedscripts
olddir /var/log/messages.d postrotate
postrotate invoke-rc.d rsyslog rotate > /dev/null
invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }

View File

@ -91,10 +91,10 @@ cp "${LOGROTATE_APTITUDE_CONF}" "${LOGROTATE_APTITUDE_FILE}"
cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}" cp "${LOGROTATE_DPKG_CONF}" "${LOGROTATE_DPKG_FILE}"
# Create an archive directory for some log files (aptitude, dpkg,…) # 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 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 /var/log/daemon /var/log/kern /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) # Create the log directory for journald (Systemd), need the configuration Storage=(auto|persistent)
mkdir -p -- /var/log/journal mkdir -p -- /var/log/journal