Varnishd stops sending logs to VSM after a while

Raymond Jennings raymond.jennings at
Fri Mar 14 22:17:13 CET 2014

I don't believe this a log rotate problem as I gave logrotate scheduled to
run at midnight.  I think this might be related to how amazon ec2 instances
sometimes change their hostnames - after varnish starts - and if I recall
the various varnish binaries make use of the hostname to find the cache
(file or memory.)

Might be this but then why does varnishd and varnishd work okay and only
logrotate does not?

On Mar 14, 2014, at 5:02 PM, Stephen Wood <smwood4 at> wrote:

My first thought is that logrotate is running and varishncsa is not
properly catching a SIGHUP after a rotate. Therefore the logfile gets
rotated but varnishncsa continues writing to the old fd.

If you run varnishncsa by itself on the command line during these periods,
do you get output? If so then it's probably not a problem with shared

If you want to test this, you can simply change the varnishncsa logrotate
behavior to use copytruncate and not bother sending a HUP, which will
truncate the log without rotating it.

For reference here's what my logrotate file looks like:

/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
  size 1G
  rotate 7
    for service in varnishlog varnishncsa; do
      if /usr/bin/pgrep -P 1 $service >/dev/null; then
        service $service reload > /dev/null

If you want to try copytruncate:

/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
  size 1G
  rotate 7

Note that you'll get a message in your log file that states it was
truncated. It may mess up your log parsing software.

On Thu, Mar 13, 2014 at 4:33 AM, Raymond Jennings <
raymond.jennings at> wrote:

> I have what might be a related problem.  I can only get varnishlog to
> write to a file after I stop it and restart it.  I am running on ec2.
> I tried various tricks to wait so many seconds after varnished starts
> then start varnishlog.   Varnishncsa runs perfectly fine right out of
> the gate.  I have had this problem for about two years now.
> Varnishlog is clearly running and "service varnishlog stop"
> successfully stops it.   "service varnishlog start" and things are
> good.
> > On Mar 13, 2014, at 6:27 AM, Thomas Lecomte <
> thomas.lecomte at> wrote:
> >
> >> On Thu, Mar 13, 2014 at 10:25:52AM +0100, Cédric Jeanneret wrote:
> >>
> >> Hmm, _.vsm is shown when we perform a simple "ls" in the directory...
> >> Else, I would get some errors from either varnishncsa or varnishlog when
> >> I start them (I tried that this morning, just to see what would
> happen)...
> >
> > Maybe you could compare the inodes using ls -i on the visible _.vsm
> > against the one shown by lsof on the varnish process.
> >
> > --
> > Thomas Lecomte / +33 4 86 13 48 65
> > Sysadmin / Virtual Expo / Marseille
> >
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at
> >
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at

Stephen Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list