Minha rotação de log está girando os arquivos já girados. Como posso parar isso? Aqui está o meu arquivo de rotação de log:
/srv/logs/httpd/example.com/* /srv/logs/httpd/sub.example.com/* {
daily
size 200M
rotate 30
missingok
notifempty
sharedscripts
compress
delaycompress
postrotate
/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
endscript
}
e meus diretórios que eu quero rotacionar são:
- /srv/logs/httpd/example.com
- /srv/logs/httpd/sub.example.com
Atualmente, meu diretório é assim:
-rw-r--r--. 1 root root 0 Apr 18 03:07 access.log.2.gz-20180417
-rw-r--r--. 1 root root 0 Apr 20 03:11 access.log.2.gz-20180417-20180418
-rw-r--r--. 1 root root 0 Apr 21 03:13 access.log.2.gz-20180417-20180418-20180420
-rw-r--r--. 1 root root 0 Apr 23 03:33 access.log.2.gz-20180417-20180418-20180420-20180421
-rw-r--r--. 1 root root 0 Apr 24 03:42 access.log.2.gz-20180417-20180418-20180420-20180421-20180423
-rw-r--r--. 1 root root 0 Apr 26 03:25 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424
-rw-r--r--. 1 root root 0 Apr 27 03:09 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426
-rw-r--r--. 1 root root 0 Apr 29 03:32 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427
-rw-r--r--. 1 root root 0 Apr 30 03:40 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429
-rw-r--r--. 1 root root 0 May 2 03:48 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430
-rw-r--r--. 1 root root 0 May 3 03:10 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430-20180502
-rw-r--r--. 1 root root 0 May 5 03:24 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430-20180502-20180503
-rw-r--r--. 1 root root 0 May 6 03:15 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430-20180502-20180503-20180505
-rw-r--r--. 1 root root 0 May 8 03:36 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430-20180502-20180503-20180505-20180506
-rw-r--r--. 1 root root 0 May 9 03:14 access.log.2.gz-20180417-20180418-20180420-20180421-20180423-20180424-20180426-20180427-20180429-20180430-20180502-20180503-20180505-20180506-20180508
O que eu fiz de errado?
logrotate 3.8.6
CentOS Linux release 7.4.1708 (Core)
Em /etc/cron.daily/logrotate
, nosso sistema tem /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
. /etc/logrotate.conf
tem:
# 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
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
O primeiro trecho que eu incluí veio de /etc/logrotate.d/httpd
, de modo que vem com o include /etc/logrotate.d
. Esse também é o único arquivo que eu modifiquei para as rotações.