logrotate Konfiguration unattended-upgrades

Diese Konfiguration nutze ich für die automatischen Updates unter Debian/Ubuntu. Dabei liegen die angelegten Logfiles standardmäßig unter „/var/log/unattended-upgrades/“. Die Konfiguration des Speicherortes passiert in der APT-Konfigurationsdatei „/etc/apt/apt.conf.d/50unattended-upgrades“ über den Parameter „APT::UnattendedUpgrades::LogDir“. Der Pfad ist in der Logrotate-Konfiguration also entsprechend zu setzen:

/var/log/unattended-upgrades/unattended-upgrades.log {
monthly
missingok
rotate 24
compress
dateext
notifempty
olddir /var/log/unattended-upgrades/old/
}

/var/log/unattended-upgrades/unattended-upgrades-dpkg*.log {
daily
missingok
rotate 92
compress
dateext
olddir /var/log/unattended-upgrades/old/
}

Die Konfiguration sollte vor dem ersten Einsatz getestet werden:

logrotate -d /etc/logrotate.d/<ConfigDatei>

Dabei kommt dann in etwa so etwas heraus:

reading config file /etc/logrotate.d/unattended-upgrades
reading config info for /var/log/unattended-upgrades/unattended-upgrades.log
olddir is now /var/log/unattended-upgrades/old/
reading config info for /var/log/unattended-upgrades/unattended-upgrades-dpkg*.log
olddir is now /var/log/unattended-upgrades/old/

Handling 2 logs

rotating pattern: /var/log/unattended-upgrades/unattended-upgrades.log monthly (24 rotations)
olddir is /var/log/unattended-upgrades/old/, empty log files are not rotated, old logs are removed
considering log /var/log/unattended-upgrades/unattended-upgrades.log
log does not need rotating

rotating pattern: /var/log/unattended-upgrades/unattended-upgrades-dpkg*.log after 1 days (92 rotations)
olddir is /var/log/unattended-upgrades/old/, empty log files are rotated, old logs are removed
considering log /var/log/unattended-upgrades/unattended-upgrades-dpkg*.log
log /var/log/unattended-upgrades/unattended-upgrades-dpkg*.log does not exist -- skipping