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
notifempty
olddir /var/log/aptitude.d olddir /var/log/aptitude.d
} }

View File

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

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
monthly
missingok missingok
monthly
create 0664 root utmp create 0664 root utmp
olddir /var/log/old_logs
}
/var/log/btmp {
monthly
rotate 3 rotate 3
missingok olddir /var/log/old_logs.d
create 0660 root utmp
olddir /var/log/old_logs }
# No packages own wtmp or btmp, they will be managed directly
/var/log/btmp {
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

View File

@ -12,58 +12,62 @@
/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 postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
/var/log/cron.log /var/log/cron.log /var/log/mark.log {
/var/log/mark.log
{
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/cron olddir /var/log/cron.d
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 olddir /var/log/daemon.d
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 maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/kern olddir /var/log/kern.d
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 olddir /var/log/lpr.d
postrotate postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
@ -75,9 +79,11 @@
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/mail olddir /var/log/mail.d
postrotate postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
@ -88,20 +94,23 @@
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/auth olddir /var/log/auth.d
postrotate postrotate
invoke-rc.d rsyslog rotate > /dev/null invoke-rc.d rsyslog rotate > /dev/null
endscript endscript
} }
/var/log/messages /var/log/messages /var/log/debug {
/var/log/debug
{
maxsize 250k maxsize 250k
missingok missingok
sharedscripts sharedscripts
olddir /var/log/messages.d 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