Varnishd stops sending logs to VSM after a while

Stephen Wood smwood4 at gmail.com
Fri Mar 14 22:01:45 CET 2014


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
memory.

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
  missingok
  compress
  delaycompress
  postrotate
    for service in varnishlog varnishncsa; do
      if /usr/bin/pgrep -P 1 $service >/dev/null; then
        service $service reload > /dev/null
      fi
    done
  endscript
}

If you want to try copytruncate:

/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
  size 1G
  rotate 7
  missingok
  compress
  delaycompress
  copytruncate
}

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 nytimes.com> 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 virtual-expo.com> 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-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



-- 
Stephen Wood
www.heystephenwood.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140314/11a8fda0/attachment.html>


More information about the varnish-misc mailing list