Nginx and logrotate

Sergey Kobzar sergey.kobzar at itcraft.org
Wed Jul 31 21:07:32 UTC 2013


Linux 3.8.13-gentoo x86_64
nginx-1.4.1-r2
logrotate-3.8.4

cat /etc/logrotate.d/nginx:
/var/log/nginx/*.log {
         daily
         rotate 5
         missingok
         nocompress
         sharedscripts
         postrotate
                 test -r /run/nginx.pid && kill -USR1 `cat /run/nginx.pid`
         endscript
}

/etc/logrotate.conf:
weekly
rotate 4
create
dateext
compress
notifempty
nomail
noolddir
include /etc/logrotate.d
/var/log/wtmp {
     monthly
     create 0664 root utmp
         minsize 1M
     rotate 1
}
/var/log/btmp {
     missingok
     monthly
     create 0600 root utmp
     rotate 1
}

# ls -alh /var/log/nginx/ | grep access.log
-rw-r--r--  1 nginx root    0 Jul 30 03:10 access.log
-rw-r--r--  1 nginx root 4.7G Jul 18 10:09 access.log-20130712
-rw-r--r--  1 nginx root 7.6G Jul 29 09:46 access.log-20130719
-rw-r--r--  1 nginx root 1.4G Jul 31 22:04 access.log-20130730

Т.е. запись в access.log не идет, а растет access.log-20130730.

kill -USR1 `cat /run/nginx.pid` ситуацию не меняет.

Что я не так?

Спасибо.



Подробная информация о списке рассылки nginx-ru