Skip to content

Instantly share code, notes, and snippets.

@marcofbb
Last active June 13, 2024 18:22
Show Gist options
  • Save marcofbb/ccf6ff872456f4d168a279218ba24272 to your computer and use it in GitHub Desktop.
Save marcofbb/ccf6ff872456f4d168a279218ba24272 to your computer and use it in GitHub Desktop.
TOP and Logs command varnish 4
# Muestro las URL que se envian al backend
varnishtop -i BereqURL
# Muestro los host de peticiones al back
varnishtop -b -I BeReqHeader:Host
# Muestro todas URL peticionadas
varnishtop -i requrl
# Mostrar peticiones metodo
varnishtop -i reqMethod
# Mostrar HTTP status
varnishtop -i respStatus
# Mostrar peticiones metodo enviados al backend
varnishtop -i bereqMethod
# Top IP address
varnishtop -i ReqStart
# Top IP address proxy
varnishtop -C -I ReqHeader:X-Forwarded-For
# Top IP adress cloudflare
varnishtop -C -I ReqHeader:CF-Connecting-IP
# Top IP adress Sucuri Security
varnishtop -C -I ReqHeader:SUCURI-CLIENTIP
# Top Referer
varnishtop -C -I ReqHeader:Referer
# Top user agent
varnishtop -C -I ReqHeader:User-Agent
# Filtrar las redirecciones permanentes (301) y mostrar host url y destino
varnishlog -q "RespStatus ~ 301" -i "ReqURL" -I "ReqHeader:Host:" -I "RespHeader:Location:" -i "RespStatus"
# Filtrar por host, y mostrar ReqURL y Referer
varnishlog -q 'ReqHeader ~ "Host: (www\.)?example\.com"' -i "ReqURL" -I "ReqHeader:Referer:"
# Show the top piped URLs
varnishtop -b -i BereqUrl -q Begin "~" "pipe"
# Show the top missed URLs
varnishtop -i ReqURL -q 'VCL_call eq "MISS"'
# See HIT requests slower than 2 seconds
varnishtop -I Timestamp:Resp -q 'Timestamp:Resp ~ "\ [2-9]\." and VCL_call eq "HIT"'
# See all the logs from a specific domain
varnishlog -q '(ReqHeader:Host ~ "example.com.br" and ReqURL eq "/") or (BereqHeader:Host ~ "example.com.br" and BereqURL eq "/")'
# Ver IP cloudflare involucradas en error 403
varnishtop -q "RespStatus ~ 403" -I "ReqHeader:CF-Connecting-IP"
#BereqMethod,BereqURL,BereqHeader,BerespStatus,BerespHeader,reqMethod,reqURL,reqHeader,respStatus,respHeader,TTL,VCL_call,VCL_return,RespHeader
@marcofbb
Copy link
Author

timeout 10s varnishncsa -F '%{CF-Connecting-IP}i %U %t' | grep '/search' | awk '{print $1}' | sort | uniq -c | sort -nr

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