Has anyone developed, or does anyone know of, any third-party tools (or non-obvious uses of the stock tools) to help a poor systems administrator determine what's going on with requests that are passing through Varnish? While varnishstat
, varnishtop
, and varnishhist
give me either very high-level (or low-level) overviews, I'm looking for something that tells me things like:
- What requests are currently in progress (and how long they've been like that, where they got sent, that sort of thing)
- Average service times for requests by backend, vhost, that sort of thing
- Other things that will help me identify misbehaving backends, vhosts, etc.
varnishncsa
displays logs in Apache/NCSA combined log format (from man page). You can use these with any normal log analyzer to find which user agents you have, which pages they load etc.varnishlog
(/usr/bin/varnishlog
) on the other hand displays detailed output for all the requests, containing information like which VCL commands are being used (lookup, hash, hit, deliver etc.) and all headers in the HTTP transaction (varnishlog -o
will group them by request). If you have a busy site this will scroll through very quickly, but you can write them to disk using-w
, or use the logger facility (/etc/init.d/varnishlog
). Be aware that this quickly fills up the disk, because it is very detailed (10-30 lines per request depending on where the requests get sent, and of course all your HTTP headers).varnishreplay
can replay the HTTP traffic from such a log file.Most of the tools can be used with regex searching.
Redpill Linpro, the company making Varnish, are currently making a web gui. I'm not sure which features it will have (I don't think they quite know either), but I am assured that it will have quite a few monitoring graphs.
varnishncsa:
One trick is to use a custom log format with
varnishncsa
to include a few more pieces of useful information such as:I use the following in my
/etc/varnish/varnishncsa
to add this information (varnishncsa documentation):This configuration allows me to grep through the access logs and add up historic hit-rates as well as find pages that respond slowly.
varnishlog:
As discussed in this question/answer, if you are having varnish perform health-checks on your back-ends you can use varnishlog to record changes in back-end health. Running
varnishlog -O -I "healthy|sick"
will give you a running update of back-end health based on health-checks.