Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.
share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
1  
And BTW, at least in Ubuntu, varnishncsa comes with associated configuration files: /etc/init.d/varnishncsa, /etc/logrotate.d/varnish, /etc/default/varnishncsa. All you need to do to start logging to /var/log/varnish/varnishncsa.log is uncomment ENABLE_VARNISHNCSA=1 in /etc/default/varnishncsa –  Pēteris Caune Jan 3 '11 at 18:16
    
Notice that today its no longer Redpill Linpro but a separate company : varnish-software.com –  Doomsday Jul 25 '12 at 7:29
add comment
  • try varnishncsa to get per request logging
  • varnish top has avg service and hit times
  • IMHO, if you suspect problems with your backends you should be monitoring the directly, without going through varnish.
share|improve this answer
    
Anything "non-obvious" I should be doing with varnishncsa to get more useful logs? The default format isn't exactly rocking my socks. varnishtop does overall averages, but doesn't do anything to break them down. And yes, there's monitoring on the backends, but it would be far better if I could determine if my backend monitoring is missing something by asking varnish. –  womble May 3 '09 at 3:48
    
You're probably going to have to write something custom. AFAIK all the varnish tools communicate via a shared memory area, check out the varnish-cache/bin tools to see how they interrogate with the main varnish process –  Dave Cheney May 3 '09 at 4:43
add comment

varnishncsa:

One trick is to use a custom log format with varnishncsa to include a few more pieces of useful information such as:

  • Response time (to first byte)
  • Hit or miss status for the request
  • The original client IP (if Varnish is behind a load-balancer)

I use the following in my /etc/varnish/varnishncsa to add this information (varnishncsa documentation):

#! /bin/sh
DAEMON_OPTS="$DAEMON_OPTS -F \"%h \\\"%{X-Forwarded-For}i\\\" %t \\\"%r\\\" %s %b \\\"%{Referer}i\\\" \\\"%{User-agent}i\\\" %{Varnish:time_firstbyte}x %{Varnish:hitmiss}x\""

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.

share|improve this answer
add comment

Your Answer

 
discard

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.