Skip to content

Instantly share code, notes, and snippets.

@drakemccabe
Last active August 23, 2016 02:50
Show Gist options
  • Save drakemccabe/1bb7dbdb143e105901bf51a27f32cd92 to your computer and use it in GitHub Desktop.
Save drakemccabe/1bb7dbdb143e105901bf51a27f32cd92 to your computer and use it in GitHub Desktop.
Varnish 3.x commands
# Get varnish version
varnishd -V
# most frequent cookies
varnishtop -i RxHeader -I Cookie
# continually updated list of frequent URLs
varnishtop -i RxURL
# most frequent UA strings
varnishtop -i RxHeader -C -I ^User-Agent
# frequent charset (Accept-Charset can be replaced with any other HTTP header)
varnishtop -i RxHeader -C -I '^Accept-Charset'
# Requests resulting in 404's
varnishlog -b -m "RxStatus:404"
# Show top misses
varnishtop -i TxURL
varnishlog -b | grep 'TxURL'
# Log requests from a specific IP
varnishlog -c -m ReqStart:10.0.1.5
# Show requests made from a specific URL
varnishlog -c -m RxURL:"<URL>"
# Show requests made by client
varnishtop -i RxURL
varnishlog -c | grep 'RxURL'
# Show cookies being sent by client
varnishtop -i RxHeader -I Cookie
varnishlog -c | grep 'Cookie: '
# Show top requested hosts
varnishtop -i RxHeader -I '^Host:'
varnishlog -i RxHeader | grep 'Host: '
# Show most popular encodings requested
varnishtop -i RxHeader -I Accept-Encoding
# Tools:
varnishtop
varnishstat (https://kly.no/posts/2009_12_08__Varnishstat_for_dummies__.html)
varnishhst
# Varnish Stat
# list available fields
varnishstat -l
varnishstat -f <field1> <field2> etc.
# list all running processes and elapsed time
ps -eo pid,cmd,etime
# Show top IP addresses
varnishtop -i TxHeader -I '^X-Forwarded-For:'
# Show traffic sources
varnishtop -i RxHeader -I \^Referer
# Which pages an IP address is hitting
varnishncsa | grep 127.0.0.1 | awk '{print $7}'
#IP addresses hitting /client URL
varnishlog -m 'RxURL:/client-perf' |grep 'X-Forwarded-For'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment