Varnish log commands

Varnish log save into log file:
sudo varnishlog -cw access.log

Varnish log read:
varnishlog -r access.log

View user-agent in realtime :
varnishtop -C -I ReqHeader:User-Agent

View user ip in realtime:
varnishtop -C -I ReqHeader:X-real-ip

View request URL in realtime:
varnishtop -C -I ReqURL

View request detail information filtered by specific URL:
varnishlog -q “ReqURL ~ ‘^/directory'”

Varnish command

Varnish is web application to increase web contents delivery time by cache. It can be installed in front of any servers with HTTP. Varnish is very fast, so it can speed up 300 to 1000 times faster.

Using Ubuntu, here’s varnish config file located:

vi /etc/varnish/default.vcl

After config varnish vcl file, you can test it using this command:

varnishd -C -f /etc/varnish/default.vcl

To varnish start / stop / restart:

service varnish start
service varnish stopĀ 
service varnish restart

To view varnish status:

service varnish status

In my case, varnish stopped working with no reason.
I found out that varnish disk was full, so I had to find out which file has the most big size.

du -h / | grep '[0-9\.]\+G'

And I narrow down and found varnish log file was too big.
After delete the file and start, it worked as normally.

Happy caching!
Bravo Varnish!