VARNISH-CLI(7) Miscellaneous Information Manual VARNISH-CLI(7) NAME varnish-cli - Varnish Command Line Interface DESCRIPTION Varnish has a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service. The CLI can be used for the following tasks: configuration You can upload, change and delete VCL files from the CLI. parameters You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page. bans Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any banned object from cache, but rather re-fetch it from its backend servers. process management You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed. If you invoke varnishd(1) with -T, -M or -d the CLI will be available. In debug mode (-d) the CLI will be in the foreground, with -T you can connect to it with varnishadm or telnet and with -M varnishd will connect back to a listening service pushing the CLI to that service. Please see varnishd(1) for details. Syntax The Varnish CLI is similar to another command line interface, the Bourne Shell. Commands are usually terminated with a newline, and they may take arguments. The command and its arguments are tokenized before parsing, and as such arguments containing spaces must be enclosed in double quotes. It means that command parsing of help banner is equivalent to "help" banner because the double quotes only indicate the boundaries of the help token. Within double quotes you can escape characters with \ (backslash). The \n, \r, and \t get translated to newlines, carriage returns, an tabs. Double quotes and backslashes themselves can be escaped with \" and \\ respectively. To enter characters in octals use the \nnn syntax. Hexadecimals can be entered with the \xnn syntax. Commands may not end with a newline when a shell-style here document (here-document or heredoc) is used. The format of a here document is: << word here document word word can be any continuous string chosen to make sure it doesn't appear naturally in the following here document. Traditionally EOF or END is used. Quoting pitfalls Integrating with the Varnish CLI can be sometimes surprising when quoting is involved. For instance in Bourne Shell the delimiter used with here documents may or may not be separated by spaces from the << token: cat <' Line 1 Pos 1) < Authenticate. backend.list [-j] [-p] [] List backends. -p also shows probe status. -j specifies JSON output. Unless -j is specified for JSON output, the output format is five columns of dynamic width, separated by white space with the fields: o Backend name o Admin: How health state is determined: o healthy: Set healthy through backend.set_health. o sick: Set sick through backend.set_health. o probe: Health state determined by a probe or some other dynamic mechanism. o deleted: Backend has been deleted, but not yet cleaned up. Admin has precedence over Health o Probe X/Y: X out of Y checks have succeeded X and Y are backend specific and may represent probe checks, other backends or any other metric. If there is no probe or the director does not provide details on probe check results, 0/0 is output. o Health: Probe health state o healthy o sick If there is no probe, healthy is output. o Last change: Timestamp when the health state last changed. The health state reported here is generic. A backend's health may also depend on the context it is being used in (e.g. the object's hash), so the actual health state as visible from VCL (e.g. using std.healthy()) may differ. For -j, the object members should be self explanatory, matching the fields described above. probe_message has the format [X, Y, "state"] as described above for Probe. JSON Probe details (-j -p arguments) are director specific. backend.set_health [auto|healthy|sick] Set health status of backend(s) matching . o With auto, the health status is determined by a probe or some other dynamic mechanism, if any o healthy sets the backend as usable o sick sets the backend as unsable ban [&& ...] Mark obsolete all objects where all the conditions match. See vcl(7)_ban for details ban.list [-j] List the active bans. Unless -j is specified for JSON output, the output format is: o Time the ban was issued. o Objects referencing this ban. o C if ban is completed = no further testing against it. o if lurker debugging is enabled: o R for req.* tests o O for obj.* tests o Pointer to ban object o Ban specification Durations of ban specifications get normalized, for example "7d" gets changed into "1w". banner Print welcome banner. help [-j|] Show command/protocol help. -j specifies JSON output. panic.clear [-z] Clear the last panic, if any, -z will clear related varnishstat counter(s) panic.show [-j] Return the last panic, if any. -j specifies JSON output -- the panic message is returned as an unstructured JSON string. param.reset [-j] Reset parameter to default value. The JSON output is the same as param.show -j and contains the updated value as it would be represented by a subsequent execution of param.show. param.set [-j] Set parameter value. The JSON output is the same as param.show -j and contains the updated value as it would be represented by a subsequent execution of param.show. This can be useful to later verify that a parameter value didn't change and to use the value from the JSON output to reset the parameter to the desired value. param.show [-l|-j] [|changed] Show parameters and their values. The long form with -l shows additional information, including documentation and minimum, maximum and default values, if defined for the parameter. JSON output is specified with -j, in which the information for the long form is included; only one of -l or -j is permitted. If a parameter is specified with , show only that parameter. If changed is specified, show only those parameters whose values differ from their defaults. pid [-j] Show the pid of the master process, and the worker if it's running. -j specifies JSON output. ping [-j] [] Keep connection alive. The response is formatted as JSON if -j is specified. quit Close connection. start Start the Varnish cache process. status [-j] Check status of Varnish cache process. -j specifies JSON output. stop Stop the Varnish cache process. storage.list [-j] List storage devices. -j specifies JSON output. vcl.deps [-j] List all loaded configuration and their dependencies. Unless -j is specified for JSON output, the output format is up to two columns of dynamic width separated by white space with the fields: o VCL: a VCL program o Dependency: another VCL program it depends on Only direct dependencies are listed, and VCLs with multiple dependencies are listed multiple times. vcl.discard ... Unload the named configurations (when possible). Unload the named configurations and labels matching at least one name pattern. All matching configurations and labels are discarded in the correct order with respect to potential dependencies. If one configuration or label could not be discarded because one of its dependencies would remain, nothing is discarded. Each individual name pattern must match at least one named configuration or label. vcl.inline [auto|cold|warm] Compile and load the VCL data under the name provided. Multi-line VCL can be input using the here document ref_syntax. vcl.label