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 {
rotate 6
monthly
compress
missingok
notifempty
olddir /var/log/aptitude.d
rotate 6
monthly
missingok
olddir /var/log/aptitude.d
}

View File

@ -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
}

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
# 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

View File

@ -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
}

View File

@ -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