untuk beberapa alasan file log lama tidak dihapus. Contoh dengan apache
Apa yang dikatakan file conf:
$ cat /etc/logrotate.d/apache2
/var/log/apache2/*.log {
weekly
missingok
rotate 2
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
}
Konten (yang dipangkas) dari folder log:
# ls /var/log/apache2/
access.log error.log.26.gz other_vhosts_access.log.20.gz access-ssl.log.14.gz
access.log.1 error.log.27.gz other_vhosts_access.log.21.gz access-ssl.log.15.gz
access.log.2.gz error.log.28.gz other_vhosts_access.log.22.gz access-ssl.log.16.gz
access.log.3.gz error.log.2.gz other_vhosts_access.log.23.gz access-ssl.log.17.gz
[...]
Sebenarnya ada banyak dari mereka:
# ls /var/log/apache2/ | wc -l
85
Perintah logrotate dengan --verbose memberi saya ini:
# /usr/sbin/logrotate --verbose /etc/logrotate.conf
[...]
reading config file apache2
reading config info for /var/log/apache2/*.log
[...]
rotating pattern: /var/log/apache2/*.log weekly (2 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/apache2/access.log
log does not need rotating
considering log /var/log/apache2/error.log
log does not need rotating
considering log /var/log/apache2/other_vhosts_access.log
log does not need rotating
considering log /var/log/apache2/pbpdhg-ssl.log
log does not need rotating
not running postrotate script, since no logs were rotated
[...]
Apa yang salah di sini? Log diputar tetapi tidak dihapus? Apa yang saya lewatkan?
access.log.3.gz
masih ada.