Log Rotation Duplicating
My log rotation is rotating the already rotated files. How can I stop this? Here's my log rotation file:
/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
}
and my directories I want rotated are:
/srv/logs/httpd/example.com
/srv/logs/httpd/sub.example.com
Currently my dir looks like this:
-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
What did I do wrong?
logrotate 3.8.6
CentOS Linux release 7.4.1708 (Core)
In /etc/cron.daily/logrotate our system has /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf. /etc/logrotate.conf has:
# 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.
The first snippet I included came from /etc/logrotate.d/httpd, so that comes in with the include /etc/logrotate.d. That also is the only file I've modified for the rotations.
/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
}
and my directories I want rotated are:
/srv/logs/httpd/example.com
/srv/logs/httpd/sub.example.com
Currently my dir looks like this:
-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
What did I do wrong?
logrotate 3.8.6
CentOS Linux release 7.4.1708 (Core)
In /etc/cron.daily/logrotate our system has /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf. /etc/logrotate.conf has:
# 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.
The first snippet I included came from /etc/logrotate.d/httpd, so that comes in with the include /etc/logrotate.d. That also is the only file I've modified for the rotations.
Комментарии
Отправить комментарий