varnishlog and logging errors

Audun Ytterdal audun at ytterdal.net
Wed Oct 19 11:25:13 CEST 2011


Hi list

I'm trying to figure out the best way of logging errors in varnish to
a logfile. The scenario am looking at is when a client get some HTTP
5XX message i want to know as much as possible about that error. The
cause of the error could be many things

1) Backend times out on connect
2) Backend times out on time to first byte
3) Backend times out on time between bytes
4) Backend failes with 503 from apache/php
5) Backend closed the connection prematurly
6) Backend did something funky
7) Client did something funky
8) Varnish vcl is configured to send a error because of some reason
(detect attacks)

And so on.

My alternatives are varnishlog and varnishncsa.

varnishlog -c  -m "TxStatus:^5" works, but vil only log the
varnish<->client data

varnishlog -b  -m "RxStatus:^5" log varnsh<->server data, but not client

removing -b and -c gives all data, but then you are flooded with extra
data that I have to filter

varnishlog   -m "TxStatus:404" |egrep -v '(SessionClose|StatSess|ExpKill)'

But here I can't log TxStatus or RxStatus and it seems to log alot of
TxStatus: 200 for some reason.

Has anyone looked into such type of logging using varnishlog or varnishnsca?

When varnish failes, is it a way to figure out if it was 1) 2) or 3)
for example?





-- 
Audun Ytterdal
http://audun.ytterdal.net




More information about the varnish-misc mailing list