Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this in logrotate.d/varnish file:

/var/log/varnish/*log {
                create 640 http log
                        /bin/kill -USR1 `cat /var/run/ 2>/dev/null` 2> /dev/null || true

And this in my /etc/rc.local file:

varnishncsa -a -w /var/log/varnish/access.log -D -P /var/run/

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?

share|improve this question
Did you get varnishncsa running after execute logrotate? Which distro are you running? – quanta Aug 9 '11 at 15:28
Yes it will be running after logrotate gets executed. The distro I'm running is ubuntu 10.04. – nixnotwin Aug 9 '11 at 16:39
Could you please run logrotate manually and give us output: logrotate -v -f /etc/logrotate.d/varnish? – quanta Aug 10 '11 at 2:31

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.

share|improve this answer
'SIGHUP' didn't work. – nixnotwin Aug 16 '11 at 12:21
SIGHUP is pretty much the universal 'tell a daemon to close and reopen logfile' signal. I'm confused why if sighup didn't work you thought sigusr1 would? Well, it's certainly possible that varnish uses sigusr1, like I said I'm not knowledgeable about it. But, I wonder if the problem is still that something is wrong with sighup handling in your version of varnish. – Phil Hollenback Aug 18 '11 at 1:02
@nixnotwin: It's kill -HUP, not -SIGHUP – XCondE May 2 '12 at 8:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.