Diese Konfiguration nutze ich für Apache2 VirtualHosts. Dabei liegen die von Apache angelegten Logfiles unter „/var/log/apache2/<vhostName>/“. Die Konfiguration des Speicherortes passiert in der VirtualHost-Konfiguration.
1 2 3 4 5 6 7 8 9 10 |
/var/log/apache2/<vhostName>/*.log { weekly missingok rotate 52 compress dateext notifempty create 640 root adm olddir /var/log/apache2/<vhostName>/old/ } |
Die Konfiguration sollte vor dem ersten Einsatz getestet werden:
1 |
logrotate -d /etc/logrotate.d/<ConfigDatei> |
Dabei kommt dann in etwa so etwas heraus:
1 2 3 4 5 6 7 8 9 10 11 12 |
reading config file /etc/logrotate.d/<ConfigDatei> reading config info for /var/log/apache2/<vhostName>/*.log olddir is now /var/log/apache2/<vhostName>/old/ Handling 1 logs rotating pattern: /var/log/apache2/<vhostName>/*.log weekly (52 rotations) olddir is /var/log/apache2/<vhostName>/old/, empty log files are not rotated, old logs are removed considering log /var/log/apache2/<vhostName>/access.log log does not need rotating considering log /var/log/apache2/<vhostName>/error.log log does not need rotating |