← 返回命令列表

Linux command

varnishlog 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show live logs

varnishlog

Include only specific tag

varnishlog -i [ReqURL]

Filter by query

varnishlog -q "[RespStatus == 500]"

Client requests only

varnishlog -c

Backend requests only

varnishlog -b

Group by request

varnishlog -g request

说明

varnishlog reads the Varnish Shared Memory Log (VSL) and displays detailed request and response information in real time. It shows the full lifecycle of HTTP transactions including client requests, backend fetches, cache decisions, and response headers. The tool provides powerful filtering through the VSL query language, allowing you to isolate specific transactions by status code, URL pattern, or any logged field. Client-side (-c) and backend-side (-b) views can be shown independently, and grouping modes organize output by request, session, or raw log entries. This makes it the primary debugging tool for understanding Varnish cache behavior.

参数

-c
Show client-side transactions only.
-b
Show backend-side transactions only.
-q _QUERY_
VSL query expression to filter transactions.
-i _TAGLIST_
Include only records with specified tags (comma-separated).
-I _TAGREGEX_
Include only records matching tag and regex pattern.
-x _TAGLIST_
Exclude records with specified tags.
-X _TAGREGEX_
Exclude records matching tag and regex pattern.
-g _MODE_
Grouping mode (raw, vxid, request, session).
-d
Process old log entries first.
-w _FILENAME_
Write output to file.

FAQ

What is the varnishlog command used for?

varnishlog reads the Varnish Shared Memory Log (VSL) and displays detailed request and response information in real time. It shows the full lifecycle of HTTP transactions including client requests, backend fetches, cache decisions, and response headers. The tool provides powerful filtering through the VSL query language, allowing you to isolate specific transactions by status code, URL pattern, or any logged field. Client-side (-c) and backend-side (-b) views can be shown independently, and grouping modes organize output by request, session, or raw log entries. This makes it the primary debugging tool for understanding Varnish cache behavior.

How do I run a basic varnishlog example?

Run `varnishlog` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c do in varnishlog?

Show client-side transactions only.