Skip to content

Instantly share code, notes, and snippets.

@swarupdonepudi
Last active June 20, 2019 21:16
Show Gist options
  • Save swarupdonepudi/60023ad84d12ec45220073e48429339e to your computer and use it in GitHub Desktop.
Save swarupdonepudi/60023ad84d12ec45220073e48429339e to your computer and use it in GitHub Desktop.
varnish-commands

list vcls

varnishadm -n /var/run/varnish-home vcl.list

Show a full vcl

varnishadm -n /var/run/varnish-home vcl.show <vcl-id>

Compile a vcl on varnish - make sure to provide absolute path

```varnishd -C -f /path/to/mysetup.vcl``

command to check nginx like access logs in varnish

varnishncsa -n /var/run/varnish-home

purge cache based on http host header

varnishadm -n /var/run/varnish-home "ban req.http.host ~ footer-service-prod-varnish.footer-service"

varnishtop -n /var/run/varnish-home -bC -i RxHeader -I connection.*close

varnishstat to look at network drop or timeout errors:

varnishstat -n /var/run/varnish-home -1 | grep -i '\(err\|fail\|drop\)

Check the default params

varnishadm -n /var/run/varnish-home param.show

Check the memory allocated to varnish daemon

varnishstat -n /var/run/varnish-home -f SMF.s0.c_bytes,SMF.s0.g_space

Command to see log entries that have 503 response code

varnishlog -q 'RespStatus == 503' -n /var/run/varnsih-home

check varnish logs for backend health probes:

varnishlog -n /var/run/varnish-home -g raw -i Backend_health

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment