I have an Apache server (2.2) running in RHEL 6.3, with the following logrotate configuration:
# Rule for Apache logs
/var/opt/apache/logs/*log {
compress
missingok
notifempty
daily
rotate 15
create 0640 www_adm apache
olddir /var/opt/apache/logs/rotated
sharedscripts
postrotate
/bin/kill -HUP `cat /var/opt/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
# Rule for Apache-Application logs
/var/opt/apache/logs/*/*log /var/opt/apache/logs/*/*/*log {
daily
copytruncate
compress
missingok
dateext
dateformat .%Y-%m-%d
rotate 90
create 0640 www_adm apache
sharedscripts
postrotate
/bin/kill -HUP `cat /var/opt/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
The cron job it's running daily without issues, but the file's rotation it's not working as expected. I'm getting files with several dates appended instead of just one per day:
mysite-ssl.2015-10-31.2015-11-02.2015-11-04.2015-11-06.2015-11-08.log
mysite-ssl.2015-10-31.2015-11-02.2015-11-04.2015-11-06.2015-11-08.2015-11-10.log
mysite-ssl.error.2015-10-21.2015-10-23.2015-10-25.2015-10-27.2015-10-29.2015-10-31.2015-11-02.2015-11-04.2015-11-06.2015-11-08.log
mysite-ssl.error.2015-10-21.2015-10-23.2015-10-25.2015-10-27.2015-10-29.2015-10-31.2015-11-02.2015-11-04.2015-11-06.2015-11-08.2015-11-10.log
mysite-ssl.2015-11-10.log.gz
mysite.2015-11-10.log.gz
mysite-ssl.2015-10-24.2015-10-26.2015-10-28.2015-10-30.2015-11-01.2015-11-03.2015-11-05.2015-11-07.2015-11-09.log
mysite-ssl.2015-10-24.2015-10-26.2015-10-28.2015-10-30.2015-11-01.2015-11-03.2015-11-05.2015-11-07.2015-11-09.2015-11-11.log
mysite-ssl.2015-11-11.log.gz
mysite.2015-11-11.log.gz
Also it seems the logrotate isn't doing anything more, in the log files (see head/tail):
[user@host mysite]$ head mysite.log ; echo "----------------" ; tail mysite.log
145.245.114.238 - - [11/Nov/2015:03:25:30 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [11/Nov/2015:03:28:07 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [11/Nov/2015:03:30:03 +0100] "HEAD / HTTP/1.1" 301 -
145.245.114.237 - - [11/Nov/2015:03:31:15 +0100] "HEAD / HTTP/1.1" 301 -
145.245.114.237 - - [11/Nov/2015:03:31:15 +0100] "HEAD /mysite HTTP/1.1" 302 -
145.245.114.238 - - [11/Nov/2015:03:31:15 +0100] "HEAD /mysite/index.html HTTP/1.1" 200 -
145.245.114.238 - - [11/Nov/2015:03:31:36 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [11/Nov/2015:03:31:48 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [11/Nov/2015:03:35:28 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [11/Nov/2015:03:38:07 +0100] "GET / HTTP/1.1" 301 306
----------------
145.245.114.238 - - [07/Jan/2016:15:41:36 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [07/Jan/2016:15:44:12 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [07/Jan/2016:15:47:41 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [07/Jan/2016:15:47:57 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [07/Jan/2016:15:51:36 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [07/Jan/2016:15:54:12 +0100] "GET / HTTP/1.1" 301 306
145.245.114.238 - - [07/Jan/2016:15:55:04 +0100] "HEAD / HTTP/1.1" 301 -
145.245.114.237 - - [07/Jan/2016:15:57:41 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [07/Jan/2016:15:57:57 +0100] "GET / HTTP/1.1" 301 306
145.245.114.237 - - [07/Jan/2016:16:01:36 +0100] "GET / HTTP/1.1" 301 306
Any idea what could be the cause of this behaviour? Is my configuration missing something?