DEPRECATED: This project has been replaced by varnishlog-parser. While I enjoy TUIs and primarily work in the terminal I wanted to quickly copy & paste the logs. Having a web interface available directly in a browser tab makes this much easier.
varnishlog-tui
allows you to inspect varnishlog transactions, find related transactions, generate small reports about them, and organize varnishlog queries.
go install github.com/aorith/varnishlog-tui@latest
You don't have to install varnishlog-tui
directly on the server running Varnish, as all it needs is a command that provides the text output from varnishlog
. You can get this output using ssh
, docker exec
, or by running cat
on a log file.
The idea is to curate a YAML file with your most used varnishlog
queries and load them using the -file
parameter.
All the views indicate the available keys at the bottom. More details in the next sections.
This view displays the current command that will be executed to retrieve varnishlog logs.
You can edit the command by pressing e
. This will open an editor according to the environment variable $EDITOR
or fall back to vim/nano.
The command(s) executed should output varnishlog logs in plain text. If you're running Varnish locally, the command can be just varnishlog
. You can also use ssh
, docker exec
, or a simple cat ~/my.log
to provide the logs, as long as the command is not interactive.
Write the command as if you were writing it in a shell script.
- Lines that start with a "#" or are empty will be ignored.
- Concatenate lines belonging to the same command with a
\
at the end.
When you press ENTER
, the view will switch to the "Transactions View" and the command will be executed to retrieve and parse the logs.
You can also press E
to format the current command as a valid YAML file for the "Query Loader" and save it wherever you want.
This view displays a list of available queries. A query is a command for the "Query Editor" that, when executed, will output varnishlog logs.
By default, only the built-in queries are shown. If varnishlog-tui
is executed with the -file
flag pointing to a YAML file with user-defined queries, those queries will be displayed at the top of the list.
varnishlog-tui -file ~/myqueries.yaml
When you press ENTER
, the selected query will replace the current one in the "Query Editor".
A valid queries YAML file has queries
as the root element and a list of entries with name
and script
fields. For example:
queries:
- name: "Host www.example.com"
script: |-
# This is a comment.
varnishlog \
-g request \
-q 'ReqHeader:Host eq "www.example.com" or BereqHeader:Host eq "www.example.com"'
- name: "URL ^/.well-known"
script: varnishlog -g request -q 'ReqURL ~ "^/.well-known" or BereqURL ~ "^/.well-known"'
This view displays a list of transactions captured by varnishlog. It is updated in real-time as transactions are parsed.
The first two lines of an item in the list can be filtered as if they were a single long line by pressing /
.
An HTML report of the selected transaction (and, if present, its related transactions) can be generated by pressing ENTER
. The application will attempt to open the generated HTML file using xdg-open
, open
, or $BROWSER
. If none of these is available, it will fall back to $EDITOR
.
To see all available keybindings and options, press ?
.
- To save the current transactions, press
ctrl-e
in the "Transactions View". This will open the full raw log in your$EDITOR
. Save it somewhere else since the temporary file will be deleted. - For analyzing time-consuming tasks in the VCL configuration, refer to timestamps and use
std.timestamp()
.
- Tested on Varnish >= 6.
- Requires the full
varnishlog
output, so it is not compatible with filters like-i
or-I
. - Does not parse verbose output (
-v
). - While there are more robust ways to retrieve logs, such as varnishlog-json or the bindings from vago, I chose to parse the raw text output. This approach doesn't require you to install the tool on the server and allows you to retrieve logs using
ssh
ordocker exec
. - For advanced filtering of transactions, use the query argument (
-q
) fromvarnishlog
. This application cannot filter transactions by values that are not shown in the "Transactions View".
varnishlog-tui
is developed with the excellent TUI framework bubbletea.