I have this in logrotate.d/varnish
file:
/var/log/varnish/*log {
create 640 http log
compress
postrotate
/bin/kill -USR1 `cat /var/run/varnishncsa.pid 2>/dev/null` 2> /dev/null || true
endscript
}
And this in my /etc/rc.local
file:
varnishncsa -a -w /var/log/varnish/access.log -D -P /var/run/varnishncsa.pid
But when logrotate creates a new access.log
file, it remains blank. I have to do sh /etc/rc.local
for logs to be saved in that file. As logrotation happens weekly, I have to execute that rc.local
every week to get the logs saved in access.log
file. What can be the issue here?
I know absolutely nothing about varnish, but it sure looks like you should be sending it a SIGHUP to do log rotation, not a SIGUSR1.
A new blank logfile is a pretty good indicator that the daemon isn't getting the message that it's supposed to close it's old logfile and switch to a new one.