Find a particular request and its relative url

If you need to find the url that serves a particular requests, i.e.: 400, you can try running this on the varnish server:

varnishlog -i RxURL,TxStatus | tee /tmp/varnish.log

It gives significantly less output and shows the URL and status code for each request. For example:

   20 BackendReuse b default
   15 RxURL        c /demo-core/incoming/6taqvb-Entertainment-1/ALTERNATES/LANDSCAPE_160/Entertainment%201
   15 TxStatus     c 304
   15 ReqEnd       c 867869363 1452013220.413259506 1452013220.423258066 0.001502037 0.009776592 0.000221968

Then look for status 400 in the /tmp/varnish.log file after some time. If found, then the URL is the preceding RxURL line with the same thread id (the first number on each line). If you force an error, it looks like this:

   11 SessionOpen  c 172.28.128.1 52198 :80
   11 RxURL        c http:
   11 TxStatus     c 400
   11 ReqEnd       c 867869378 1452013439.989470720 1452013439.991159678 0.000198126 0.001594067 0.000094891
   11 SessionClose c not HTTP/1.1

“http:” is the invalid URL in this case.