File manager - Edit - /usr/share/doc/varnish/html/reference/varnish-cli.html
Back
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>varnish-cli — Varnish version 7.1.1 documentation</title> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="VSL" href="vsl.html" /> <link rel="prev" title="varnishadm" href="varnishadm.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="vsl.html" title="VSL" accesskey="N">next</a> |</li> <li class="right" > <a href="varnishadm.html" title="varnishadm" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.1.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">varnish-cli</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="varnish-cli"> <span id="varnish-cli-7"></span><h1>varnish-cli<a class="headerlink" href="#varnish-cli" title="Permalink to this headline">¶</a></h1> <div class="section" id="varnish-command-line-interface"> <h2>Varnish Command Line Interface<a class="headerlink" href="#varnish-command-line-interface" title="Permalink to this headline">¶</a></h2> <dl class="field-list simple"> <dt class="field-odd">Manual section</dt> <dd class="field-odd"><p>7</p> </dd> </dl> <div class="section" id="description"> <h3>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h3> <p>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.</p> <p>The CLI can be used for the following tasks:</p> <dl class="simple"> <dt>configuration</dt><dd><p>You can upload, change and delete VCL files from the CLI.</p> </dd> <dt>parameters</dt><dd><p>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.</p> </dd> <dt>bans</dt><dd><p>Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any <em>banned</em> object from cache, but rather re-fetch it from its backend servers.</p> </dd> <dt>process management</dt><dd><p>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.</p> </dd> </dl> <p>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 <em>pushing</em> the CLI to that service. Please see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a> for details.</p> <div class="section" id="syntax"> <span id="ref-syntax"></span><h4>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h4> <p>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 <em>tokenized</em> before parsing, and as such arguments containing spaces must be enclosed in double quotes.</p> <p>It means that command parsing of</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">help</span> <span class="n">banner</span> </pre></div> </div> <p>is equivalent to</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s2">"help"</span> <span class="n">banner</span> </pre></div> </div> <p>because the double quotes only indicate the boundaries of the <code class="docutils literal notranslate"><span class="pre">help</span></code> token.</p> <p>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.</p> <p>To enter characters in octals use the \nnn syntax. Hexadecimals can be entered with the \xnn syntax.</p> <p>Commands may not end with a newline when a shell-style <em>here document</em> (here-document or heredoc) is used. The format of a here document is:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o"><<</span> <span class="n">word</span> <span class="n">here</span> <span class="n">document</span> <span class="n">word</span> </pre></div> </div> <p><em>word</em> can be any continuous string chosen to make sure it doesn’t appear naturally in the following <em>here document</em>. Traditionally EOF or END is used.</p> </div> <div class="section" id="quoting-pitfalls"> <h4>Quoting pitfalls<a class="headerlink" href="#quoting-pitfalls" title="Permalink to this headline">¶</a></h4> <p>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 <code class="docutils literal notranslate"><span class="pre"><<</span></code> token:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cat</span> <span class="o"><<</span><span class="n">EOF</span> <span class="n">hello</span> <span class="n">world</span> <span class="n">EOF</span> <span class="n">hello</span> <span class="n">world</span> </pre></div> </div> <p>With the Varnish CLI, the <code class="docutils literal notranslate"><span class="pre"><<</span></code> and <code class="docutils literal notranslate"><span class="pre">EOF</span></code> tokens must be separated by at least one blank:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">boot</span> <span class="o"><<</span><span class="n">EOF</span> <span class="mi">106</span> <span class="mi">258</span> <span class="n">Message</span> <span class="kn">from</span> <span class="nn">VCC</span><span class="o">-</span><span class="n">compiler</span><span class="p">:</span> <span class="n">VCL</span> <span class="n">version</span> <span class="n">declaration</span> <span class="n">missing</span> <span class="n">Update</span> <span class="n">your</span> <span class="n">VCL</span> <span class="n">to</span> <span class="n">Version</span> <span class="mi">4</span> <span class="n">syntax</span><span class="p">,</span> <span class="ow">and</span> <span class="n">add</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">on</span> <span class="n">the</span> <span class="n">first</span> <span class="n">line</span> <span class="n">of</span> <span class="n">the</span> <span class="n">VCL</span> <span class="n">files</span><span class="o">.</span> <span class="p">(</span><span class="s1">'<vcl.inline>'</span> <span class="n">Line</span> <span class="mi">1</span> <span class="n">Pos</span> <span class="mi">1</span><span class="p">)</span> <span class="o"><<</span><span class="n">EOF</span> <span class="c1">##---</span> <span class="n">Running</span> <span class="n">VCC</span><span class="o">-</span><span class="n">compiler</span> <span class="n">failed</span><span class="p">,</span> <span class="n">exited</span> <span class="k">with</span> <span class="mi">2</span> <span class="n">VCL</span> <span class="n">compilation</span> <span class="n">failed</span> </pre></div> </div> <p>With the missing space, the here document can be added and the actual VCL can be loaded:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">test</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">be</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"localhost"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span> <span class="mi">200</span> <span class="mi">14</span> <span class="n">VCL</span> <span class="n">compiled</span><span class="o">.</span> </pre></div> </div> <p>A big difference with a shell here document is the handling of the <code class="docutils literal notranslate"><span class="pre"><<</span></code> token. Just like command names can be quoted, the here document token keeps its meaning, even quoted:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">test</span> <span class="s2">"<<"</span> <span class="n">EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">be</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"localhost"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span> <span class="mi">200</span> <span class="mi">14</span> <span class="n">VCL</span> <span class="n">compiled</span><span class="o">.</span> </pre></div> </div> <p>When using a front-end to the Varnish-CLI like <code class="docutils literal notranslate"><span class="pre">varnishadm</span></code>, one must take into account the double expansion happening. First in the shell launching the <code class="docutils literal notranslate"><span class="pre">varnishadm</span></code> command and then in the Varnish CLI itself. When a command’s parameter require spaces, you need to ensure that the Varnish CLI will see the double quotes:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">param</span><span class="o">.</span><span class="n">set</span> <span class="n">cc_command</span> <span class="s1">'"my alternate cc command"'</span> <span class="n">Change</span> <span class="n">will</span> <span class="n">take</span> <span class="n">effect</span> <span class="n">when</span> <span class="n">VCL</span> <span class="n">script</span> <span class="ow">is</span> <span class="n">reloaded</span> </pre></div> </div> <p>Otherwise if you don’t quote the quotes, you may get a seemingly unrelated error message:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">param</span><span class="o">.</span><span class="n">set</span> <span class="n">cc_command</span> <span class="s2">"my alternate cc command"</span> <span class="n">Unknown</span> <span class="n">request</span><span class="o">.</span> <span class="n">Type</span> <span class="s1">'help'</span> <span class="k">for</span> <span class="n">more</span> <span class="n">info</span><span class="o">.</span> <span class="n">Too</span> <span class="n">many</span> <span class="n">parameters</span> <span class="n">Command</span> <span class="n">failed</span> <span class="k">with</span> <span class="n">error</span> <span class="n">code</span> <span class="mi">105</span> </pre></div> </div> <p>If you are quoting with a here document, you must wrap it inside a shell multi-line argument:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">test</span> <span class="s1">'<< EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">be</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"localhost"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span><span class="s1">'</span> <span class="n">VCL</span> <span class="n">compiled</span><span class="o">.</span> </pre></div> </div> <p>Another difference with a shell here document is that only one here document can be used on a single command line. For example, it is possible to do this in a shell script:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/bin/sh</span> <span class="n">cat</span> <span class="o"><<</span> <span class="n">EOF1</span> <span class="p">;</span> <span class="n">cat</span> <span class="o"><<</span> <span class="n">EOF2</span> <span class="n">hello</span> <span class="n">EOF1</span> <span class="n">world</span> <span class="n">EOF2</span> </pre></div> </div> <p>The expected output is:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">hello</span> <span class="n">world</span> </pre></div> </div> <p>With the Varnish CLI, only the last parameter may use the here document form, which greatly restricts the number of commands that can effectively use them. Trying to use multiple here documents only takes the last one into account.</p> <p>For example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">command</span> <span class="n">argument</span> <span class="o"><<</span> <span class="n">EOF1</span> <span class="o"><<</span> <span class="n">EOF2</span> <span class="n">heredoc1</span> <span class="n">EOF1</span> <span class="n">heredoc2</span> <span class="n">EOF2</span> </pre></div> </div> <p>This conceptually results in the following command line:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">"command"</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">"argument"</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">"<<"</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">"EOF1"</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">"heredoc1\nEOF1\nheredoc2\n"</span></code></p></li> </ul> <p>Other pitfalls include variable expansion of the shell invoking <code class="docutils literal notranslate"><span class="pre">varnishadm</span></code> but this is not directly related to the Varnish CLI. If you get the quoting right you should be fine even with complex commands.</p> </div> <div class="section" id="json"> <h4>JSON<a class="headerlink" href="#json" title="Permalink to this headline">¶</a></h4> <p>A number of commands with informational responses support a <code class="docutils literal notranslate"><span class="pre">-j</span></code> parameter for JSON output, as specified below. The top-level structure of the JSON response is an array with these first three elements:</p> <ul class="simple"> <li><p>A version number for the JSON format (integer)</p></li> <li><p>An array of strings that comprise the CLI command just received</p></li> <li><p>The time at which the response was generated, as a Unix epoch time in seconds with millisecond precision (floating point)</p></li> </ul> <p>The remaining elements of the array form the data that are specific to the CLI command, and their structure and content depend on the command.</p> <p>For example, the response to <code class="docutils literal notranslate"><span class="pre">status</span> <span class="pre">-j</span></code> just contains a string in the top-level array indicating the state of the child process (<code class="docutils literal notranslate"><span class="pre">"running"</span></code>, <code class="docutils literal notranslate"><span class="pre">"stopped"</span></code> and so forth):</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="mi">2</span><span class="p">,</span> <span class="p">[</span><span class="s2">"status"</span><span class="p">,</span> <span class="s2">"-j"</span><span class="p">],</span> <span class="mf">1538031732.632</span><span class="p">,</span> <span class="s2">"running"</span> <span class="p">]</span> </pre></div> </div> <p>The JSON responses to other commands may have longer lists of elements, which may have simple data types or form structured objects.</p> <p>JSON output is only returned if command execution was successful. The output for an error response is always the same as it would have been for the command without the <code class="docutils literal notranslate"><span class="pre">-j</span></code> parameter.</p> </div> <div class="section" id="commands"> <h4>Commands<a class="headerlink" href="#commands" title="Permalink to this headline">¶</a></h4> <div class="section" id="auth-response"> <span id="ref-cli-auth"></span><h5>auth <response><a class="headerlink" href="#auth-response" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Authenticate.</p> </div></blockquote> </div> <div class="section" id="backend-list-j-p-backend-pattern"> <span id="ref-cli-backend-list"></span><h5>backend.list [-j] [-p] [<backend_pattern>]<a class="headerlink" href="#backend-list-j-p-backend-pattern" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List backends.</p> <p><code class="docutils literal notranslate"><span class="pre">-p</span></code> also shows probe status.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output.</p> <p>Unless <code class="docutils literal notranslate"><span class="pre">-j</span></code> is specified for JSON output, the output format is five columns of dynamic width, separated by white space with the fields:</p> <ul> <li><p>Backend name</p></li> <li><p>Admin: How health state is determined:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">healthy</span></code>: Set <code class="docutils literal notranslate"><span class="pre">healthy</span></code> through <code class="docutils literal notranslate"><span class="pre">backend.set_health</span></code>.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">sick</span></code>: Set <code class="docutils literal notranslate"><span class="pre">sick</span></code> through <code class="docutils literal notranslate"><span class="pre">backend.set_health</span></code>.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">probe</span></code>: Health state determined by a probe or some other dynamic mechanism.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">deleted</span></code>: Backend has been deleted, but not yet cleaned up.</p></li> </ul> <p>Admin has precedence over Health</p> </li> <li><p>Probe <code class="docutils literal notranslate"><span class="pre">X/Y</span></code>: <em>X</em> out of <em>Y</em> checks have succeeded</p> <p><em>X</em> and <em>Y</em> are backend specific and may represent probe checks, other backends or any other metric.</p> <p>If there is no probe or the director does not provide details on probe check results, <code class="docutils literal notranslate"><span class="pre">0/0</span></code> is output.</p> </li> <li><p>Health: Probe health state</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">healthy</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">sick</span></code></p></li> </ul> <p>If there is no probe, <code class="docutils literal notranslate"><span class="pre">healthy</span></code> is output.</p> </li> <li><p>Last change: Timestamp when the health state last changed.</p></li> </ul> <p>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 <code class="docutils literal notranslate"><span class="pre">std.healthy()</span></code>) may differ.</p> <p>For <code class="docutils literal notranslate"><span class="pre">-j</span></code>, the object members should be self explanatory, matching the fields described above. <code class="docutils literal notranslate"><span class="pre">probe_message</span></code> has the format <code class="docutils literal notranslate"><span class="pre">[X,</span> <span class="pre">Y,</span> <span class="pre">"state"]</span></code> as described above for Probe. JSON Probe details (<code class="docutils literal notranslate"><span class="pre">-j</span> <span class="pre">-p</span></code> arguments) are director specific.</p> </div></blockquote> </div> <div class="section" id="backend-set-health-backend-pattern-auto-healthy-sick"> <span id="ref-cli-backend-set-health"></span><h5>backend.set_health <backend_pattern> [auto|healthy|sick]<a class="headerlink" href="#backend-set-health-backend-pattern-auto-healthy-sick" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Set health status of backend(s) matching <backend_pattern>.</p> <ul class="simple"> <li><p>With <code class="docutils literal notranslate"><span class="pre">auto</span></code>, the health status is determined by a probe or some other dynamic mechanism, if any</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">healthy</span></code> sets the backend as usable</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">sick</span></code> sets the backend as unsable</p></li> </ul> </div></blockquote> </div> <div class="section" id="ban-field-operator-arg-field-oper-arg"> <span id="ref-cli-ban"></span><h5>ban <field> <operator> <arg> [&& <field> <oper> <arg> …]<a class="headerlink" href="#ban-field-operator-arg-field-oper-arg" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Mark obsolete all objects where all the conditions match.</p> <p>See <a class="reference internal" href="vcl.html#vcl-7-ban"><span class="std std-ref">ban(STRING)</span></a> for details</p> </div></blockquote> </div> <div class="section" id="ban-list-j"> <span id="ref-cli-ban-list"></span><h5>ban.list [-j]<a class="headerlink" href="#ban-list-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List the active bans.</p> <p>Unless <code class="docutils literal notranslate"><span class="pre">-j</span></code> is specified for JSON output, the output format is:</p> <ul class="simple"> <li><p>Time the ban was issued.</p></li> <li><p>Objects referencing this ban.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">C</span></code> if ban is completed = no further testing against it.</p></li> <li><p>if <code class="docutils literal notranslate"><span class="pre">lurker</span></code> debugging is enabled:</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">R</span></code> for req.* tests</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">O</span></code> for obj.* tests</p></li> <li><p>Pointer to ban object</p></li> </ul> </li> <li><p>Ban specification</p></li> </ul> <p>Durations of ban specifications get normalized, for example “7d” gets changed into “1w”.</p> </div></blockquote> </div> <div class="section" id="banner"> <span id="ref-cli-banner"></span><h5>banner<a class="headerlink" href="#banner" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Print welcome banner.</p> </div></blockquote> </div> <div class="section" id="help-j-command"> <span id="ref-cli-help"></span><h5>help [-j|<command>]<a class="headerlink" href="#help-j-command" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Show command/protocol help.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output.</p> </div></blockquote> </div> <div class="section" id="panic-clear-z"> <span id="ref-cli-panic-clear"></span><h5>panic.clear [-z]<a class="headerlink" href="#panic-clear-z" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Clear the last panic, if any, -z will clear related varnishstat counter(s)</p> </div></blockquote> </div> <div class="section" id="panic-show-j"> <span id="ref-cli-panic-show"></span><h5>panic.show [-j]<a class="headerlink" href="#panic-show-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Return the last panic, if any.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output – the panic message is returned as an unstructured JSON string.</p> </div></blockquote> </div> <div class="section" id="param-reset-param"> <span id="ref-cli-param-reset"></span><h5>param.reset <param><a class="headerlink" href="#param-reset-param" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Reset parameter to default value.</p> </div></blockquote> </div> <div class="section" id="param-set-j-param-value"> <span id="ref-cli-param-set"></span><h5>param.set [-j] <param> <value><a class="headerlink" href="#param-set-j-param-value" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Set parameter value.</p> <p>The JSON output is the same as <code class="docutils literal notranslate"><span class="pre">param.show</span> <span class="pre">-j</span> <span class="pre"><param></span></code> and contains the updated value as it would be represented by a subsequent execution of <code class="docutils literal notranslate"><span class="pre">param.show</span></code>.</p> <p>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.</p> </div></blockquote> </div> <div class="section" id="param-show-l-j-param-changed"> <span id="ref-cli-param-show"></span><h5>param.show [-l|-j] [<param>|changed]<a class="headerlink" href="#param-show-l-j-param-changed" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Show parameters and their values.</p> <p>The long form with <code class="docutils literal notranslate"><span class="pre">-l</span></code> shows additional information, including documentation and minimum, maximum and default values, if defined for the parameter. JSON output is specified with <code class="docutils literal notranslate"><span class="pre">-j</span></code>, in which the information for the long form is included; only one of <code class="docutils literal notranslate"><span class="pre">-l</span></code> or <code class="docutils literal notranslate"><span class="pre">-j</span></code> is permitted. If a parameter is specified with <code class="docutils literal notranslate"><span class="pre"><param></span></code>, show only that parameter. If <code class="docutils literal notranslate"><span class="pre">changed</span></code> is specified, show only those parameters whose values differ from their defaults.</p> </div></blockquote> </div> <div class="section" id="pid-j"> <span id="ref-cli-pid"></span><h5>pid [-j]<a class="headerlink" href="#pid-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Show the pid of the master process, and the worker if it’s running.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output.</p> </div></blockquote> </div> <div class="section" id="ping-j-timestamp"> <span id="ref-cli-ping"></span><h5>ping [-j] [<timestamp>]<a class="headerlink" href="#ping-j-timestamp" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Keep connection alive.</p> <p>The response is formatted as JSON if <code class="docutils literal notranslate"><span class="pre">-j</span></code> is specified.</p> </div></blockquote> </div> <div class="section" id="quit"> <span id="ref-cli-quit"></span><h5>quit<a class="headerlink" href="#quit" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Close connection.</p> </div></blockquote> </div> <div class="section" id="start"> <span id="ref-cli-start"></span><h5>start<a class="headerlink" href="#start" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Start the Varnish cache process.</p> </div></blockquote> </div> <div class="section" id="status-j"> <span id="ref-cli-status"></span><h5>status [-j]<a class="headerlink" href="#status-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Check status of Varnish cache process.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output.</p> </div></blockquote> </div> <div class="section" id="stop"> <span id="ref-cli-stop"></span><h5>stop<a class="headerlink" href="#stop" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Stop the Varnish cache process.</p> </div></blockquote> </div> <div class="section" id="storage-list-j"> <span id="ref-cli-storage-list"></span><h5>storage.list [-j]<a class="headerlink" href="#storage-list-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List storage devices.</p> <p><code class="docutils literal notranslate"><span class="pre">-j</span></code> specifies JSON output.</p> </div></blockquote> </div> <div class="section" id="vcl-deps-j"> <span id="ref-cli-vcl-deps"></span><h5>vcl.deps [-j]<a class="headerlink" href="#vcl-deps-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List all loaded configuration and their dependencies.</p> <p>Unless <code class="docutils literal notranslate"><span class="pre">-j</span></code> is specified for JSON output, the output format is up to two columns of dynamic width separated by white space with the fields:</p> <ul class="simple"> <li><p>VCL: a VCL program</p></li> <li><p>Dependency: another VCL program it depends on</p></li> </ul> <p>Only direct dependencies are listed, and VCLs with multiple dependencies are listed multiple times.</p> </div></blockquote> </div> <div class="section" id="vcl-discard-name-pattern"> <span id="ref-cli-vcl-discard"></span><h5>vcl.discard <name_pattern>…<a class="headerlink" href="#vcl-discard-name-pattern" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Unload the named configurations (when possible).</p> <p>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.</p> </div></blockquote> </div> <div class="section" id="vcl-inline-configname-quoted-vclstring-auto-cold-warm"> <span id="ref-cli-vcl-inline"></span><h5>vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]<a class="headerlink" href="#vcl-inline-configname-quoted-vclstring-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Compile and load the VCL data under the name provided.</p> <p>Multi-line VCL can be input using the here document <a class="reference internal" href="#ref-syntax"><span class="std std-ref">Syntax</span></a>.</p> </div></blockquote> </div> <div class="section" id="vcl-label-label-configname"> <span id="ref-cli-vcl-label"></span><h5>vcl.label <label> <configname><a class="headerlink" href="#vcl-label-label-configname" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Apply label to configuration.</p> <p>A VCL label is like a UNIX symbolic link, a name without substance, which points to another VCL.</p> <p>Labels are mandatory whenever one VCL references another.</p> </div></blockquote> </div> <div class="section" id="vcl-list-j"> <span id="ref-cli-vcl-list"></span><h5>vcl.list [-j]<a class="headerlink" href="#vcl-list-j" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List all loaded configuration.</p> <p>Unless <code class="docutils literal notranslate"><span class="pre">-j</span></code> is specified for JSON output, the output format is five or seven columns of dynamic width, separated by white space with the fields:</p> <ul class="simple"> <li><p>status: active, available or discarded</p></li> <li><p>state: label, cold, warm, or auto</p></li> <li><p>temperature: init, cold, warm, busy or cooling</p></li> <li><p>busy: number of references to this vcl (integer)</p></li> <li><p>name: the name given to this vcl or label</p></li> <li><p>[ <code class="docutils literal notranslate"><span class="pre"><-</span></code> | <code class="docutils literal notranslate"><span class="pre">-></span></code> ] and label info last two fields)</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">-></span></code> <vcl> : label “points to” the named <vcl></p></li> <li><p><code class="docutils literal notranslate"><span class="pre"><-</span></code> (<n> label[s]): the vcl has <n> label(s)</p></li> </ul> </li> </ul> </div></blockquote> </div> <div class="section" id="vcl-load-configname-filename-auto-cold-warm"> <span id="ref-cli-vcl-load"></span><h5>vcl.load <configname> <filename> [auto|cold|warm]<a class="headerlink" href="#vcl-load-configname-filename-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Compile and load the VCL file under the name provided.</p> </div></blockquote> </div> <div class="section" id="vcl-show-v-configname"> <span id="ref-cli-vcl-show"></span><h5>vcl.show [-v] [<configname>]<a class="headerlink" href="#vcl-show-v-configname" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Display the source code for the specified configuration.</p> </div></blockquote> </div> <div class="section" id="vcl-state-configname-auto-cold-warm"> <span id="ref-cli-vcl-state"></span><h5>vcl.state <configname> [auto|cold|warm]<a class="headerlink" href="#vcl-state-configname-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Force the state of the named configuration.</p> </div></blockquote> </div> <div class="section" id="vcl-symtab"> <span id="ref-cli-vcl-symtab"></span><h5>vcl.symtab<a class="headerlink" href="#vcl-symtab" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Dump the VCL symbol-tables.</p> </div></blockquote> </div> <div class="section" id="vcl-use-configname-label"> <span id="ref-cli-vcl-use"></span><h5>vcl.use <configname|label><a class="headerlink" href="#vcl-use-configname-label" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Switch to the named configuration immediately.</p> </div></blockquote> </div> </div> <div class="section" id="backend-pattern"> <h4>Backend Pattern<a class="headerlink" href="#backend-pattern" title="Permalink to this headline">¶</a></h4> <p>A backend pattern can be a backend name or a combination of a VCL name and backend name in “VCL.backend” format. If the VCL name is omitted, the active VCL is assumed. Partial matching on the backend and VCL names is supported using shell-style wildcards, e.g. asterisk (*).</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">backend</span><span class="o">.</span><span class="n">list</span> <span class="n">def</span><span class="o">*</span> <span class="n">backend</span><span class="o">.</span><span class="n">list</span> <span class="n">b</span><span class="o">*.</span><span class="n">def</span><span class="o">*</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="n">default</span> <span class="n">sick</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="n">def</span><span class="o">*</span> <span class="n">healthy</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="o">*</span> <span class="n">auto</span> </pre></div> </div> </div> <div class="section" id="ban-expressions"> <h4>Ban Expressions<a class="headerlink" href="#ban-expressions" title="Permalink to this headline">¶</a></h4> <p>A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with “&&”.</p> <p>A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.</p> <p>Operators are “==” for direct comparison, “~” for a regular expression match, and “>” or “<” for size comparisons. Prepending an operator with “!” negates the expression.</p> <p>The argument could be a quoted string, a regexp, or an integer. Integers can have “KB”, “MB”, “GB” or “TB” appended for size related fields.</p> </div> <div class="section" id="vcl-temperature"> <span id="ref-vcl-temperature"></span><h4>VCL Temperature<a class="headerlink" href="#vcl-temperature" title="Permalink to this headline">¶</a></h4> <p>A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over.</p> <p>Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can’t escape that. However, most of the time you want to pay the price only for the active VCL and keep older VCLs in case you’d need to rollback to a previous version.</p> <p>The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it.</p> </div> </div> <div class="section" id="examples"> <h3>EXAMPLES<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h3> <p>Load a multi-line VCL using shell-style <em>here document</em>:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">example</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">www</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"127.0.0.1"</span><span class="p">;</span> <span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="s2">"8080"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span> </pre></div> </div> <p>Ban all requests where req.url exactly matches the string /news:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ban</span> <span class="n">req</span><span class="o">.</span><span class="n">url</span> <span class="o">==</span> <span class="s2">"/news"</span> </pre></div> </div> <p>Ban all documents where the serving host is “example.com” or “www.example.com”, and where the Set-Cookie header received from the backend contains “USERID=1663”:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ban</span> <span class="n">req</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">host</span> <span class="o">~</span> <span class="s2">"^(?i)(www</span><span class="se">\\</span><span class="s2">.)?example</span><span class="se">\\</span><span class="s2">.com$"</span> <span class="o">&&</span> <span class="n">obj</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">set</span><span class="o">-</span><span class="n">cookie</span> <span class="o">~</span> <span class="s2">"USERID=1663"</span> </pre></div> </div> </div> <div class="section" id="authors"> <h3>AUTHORS<a class="headerlink" href="#authors" title="Permalink to this headline">¶</a></h3> <p>This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp.</p> </div> <div class="section" id="see-also"> <h3>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><p><a class="reference internal" href="varnishadm.html#varnishadm-1"><span class="std std-ref">varnishadm</span></a></p></li> <li><p><a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></p></li> <li><p><a class="reference internal" href="vcl.html#vcl-7"><span class="std std-ref">VCL</span></a></p></li> <li><p>For API use of the CLI: The Reference Manual.</p></li> </ul> </div> </div> </div> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">varnish-cli</a><ul> <li><a class="reference internal" href="#varnish-command-line-interface">Varnish Command Line Interface</a><ul> <li><a class="reference internal" href="#description">DESCRIPTION</a><ul> <li><a class="reference internal" href="#syntax">Syntax</a></li> <li><a class="reference internal" href="#quoting-pitfalls">Quoting pitfalls</a></li> <li><a class="reference internal" href="#json">JSON</a></li> <li><a class="reference internal" href="#commands">Commands</a><ul> <li><a class="reference internal" href="#auth-response">auth <response></a></li> <li><a class="reference internal" href="#backend-list-j-p-backend-pattern">backend.list [-j] [-p] [<backend_pattern>]</a></li> <li><a class="reference internal" href="#backend-set-health-backend-pattern-auto-healthy-sick">backend.set_health <backend_pattern> [auto|healthy|sick]</a></li> <li><a class="reference internal" href="#ban-field-operator-arg-field-oper-arg">ban <field> <operator> <arg> [&& <field> <oper> <arg> …]</a></li> <li><a class="reference internal" href="#ban-list-j">ban.list [-j]</a></li> <li><a class="reference internal" href="#banner">banner</a></li> <li><a class="reference internal" href="#help-j-command">help [-j|<command>]</a></li> <li><a class="reference internal" href="#panic-clear-z">panic.clear [-z]</a></li> <li><a class="reference internal" href="#panic-show-j">panic.show [-j]</a></li> <li><a class="reference internal" href="#param-reset-param">param.reset <param></a></li> <li><a class="reference internal" href="#param-set-j-param-value">param.set [-j] <param> <value></a></li> <li><a class="reference internal" href="#param-show-l-j-param-changed">param.show [-l|-j] [<param>|changed]</a></li> <li><a class="reference internal" href="#pid-j">pid [-j]</a></li> <li><a class="reference internal" href="#ping-j-timestamp">ping [-j] [<timestamp>]</a></li> <li><a class="reference internal" href="#quit">quit</a></li> <li><a class="reference internal" href="#start">start</a></li> <li><a class="reference internal" href="#status-j">status [-j]</a></li> <li><a class="reference internal" href="#stop">stop</a></li> <li><a class="reference internal" href="#storage-list-j">storage.list [-j]</a></li> <li><a class="reference internal" href="#vcl-deps-j">vcl.deps [-j]</a></li> <li><a class="reference internal" href="#vcl-discard-name-pattern">vcl.discard <name_pattern>…</a></li> <li><a class="reference internal" href="#vcl-inline-configname-quoted-vclstring-auto-cold-warm">vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-label-label-configname">vcl.label <label> <configname></a></li> <li><a class="reference internal" href="#vcl-list-j">vcl.list [-j]</a></li> <li><a class="reference internal" href="#vcl-load-configname-filename-auto-cold-warm">vcl.load <configname> <filename> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-show-v-configname">vcl.show [-v] [<configname>]</a></li> <li><a class="reference internal" href="#vcl-state-configname-auto-cold-warm">vcl.state <configname> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-symtab">vcl.symtab</a></li> <li><a class="reference internal" href="#vcl-use-configname-label">vcl.use <configname|label></a></li> </ul> </li> <li><a class="reference internal" href="#backend-pattern">Backend Pattern</a></li> <li><a class="reference internal" href="#ban-expressions">Ban Expressions</a></li> <li><a class="reference internal" href="#vcl-temperature">VCL Temperature</a></li> </ul> </li> <li><a class="reference internal" href="#examples">EXAMPLES</a></li> <li><a class="reference internal" href="#authors">AUTHORS</a></li> <li><a class="reference internal" href="#see-also">SEE ALSO</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="varnishadm.html" title="previous chapter">varnishadm</a></p> <h4>Next topic</h4> <p class="topless"><a href="vsl.html" title="next chapter">VSL</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/varnish-cli.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="vsl.html" title="VSL" >next</a> |</li> <li class="right" > <a href="varnishadm.html" title="varnishadm" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.1.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">varnish-cli</a></li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2014, Varnish Software AS. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3. </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.39 |
proxy
|
phpinfo
|
Settings