varnishlog's poor man's filtering language
1 minute read

Currently, varnishlog does not support very advanced filtering. If you run it with -o, you can also do a regular expression match on tag + expression. An example would be varnishlog -o TxStatus 404 to only show log records where the transmitted status is 404 (not found).

While in Brazil, I needed something a bit more expressive. I needed something that would tell me if I had vcl_recv call pass and the URL ended in .jpg.

varnishlog -o -c | perl -ne 'BEGIN { $/ = "";} print if
(/RxURL.*jpg$/m and /VCL_call.*recv pass/);'

fixed this for me.

Back to posts