|
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | 4 | <meta charset="utf-8" /> |
5 | | - <title>HAProxy version 3.1-dev10-40 - Configuration Manual</title> |
| 5 | + <title>HAProxy version 3.1-dev10-50 - Configuration Manual</title> |
6 | 6 | <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> |
7 | 7 | <link href="https://raw.githubusercontent.com/thomaspark/bootswatch/v3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" /> |
8 | 8 | <link href="../css/page.css?0.4.2-15" rel="stylesheet" /> |
|
4356 | 4356 |
|
4357 | 4357 | <a class="list-group-item" href="#weight">weight</a> |
4358 | 4358 |
|
| 4359 | + <a class="list-group-item" href="#when">when</a> |
| 4360 | + |
4359 | 4361 | <a class="list-group-item" href="#word">word</a> |
4360 | 4362 |
|
4361 | 4363 | <a class="list-group-item" href="#ws">ws</a> |
|
4400 | 4402 | You can use <strong>left</strong> and <strong>right</strong> arrow keys to navigate between chapters.<br> |
4401 | 4403 | </p> |
4402 | 4404 | <p class="text-right"> |
4403 | | - <small>Converted with <a href="https://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> v<b>0.4.2-15</b> on <b>2024/10/17</b></small> |
| 4405 | + <small>Converted with <a href="https://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> v<b>0.4.2-15</b> on <b>2024/10/22</b></small> |
4404 | 4406 | </p> |
4405 | 4407 | </div> |
4406 | 4408 | <!-- /.sidebar --> |
|
4411 | 4413 | <div class="text-center"> |
4412 | 4414 | <h1><a href="http://www.haproxy.org/" title="HAProxy"><img src="../img/HAProxyCommunityEdition_60px.png?0.4.2-15" /></a></h1> |
4413 | 4415 | <h2>Configuration Manual</h2> |
4414 | | - <p><strong>version 3.1-dev10-40</strong></p> |
| 4416 | + <p><strong>version 3.1-dev10-50</strong></p> |
4415 | 4417 | <p> |
4416 | 4418 | 2024/10/16<br> |
4417 | 4419 |
|
@@ -23575,9 +23577,10 @@ <h3 id="chapter-7.3.1" data-target="7.3.1"><small><a class="small" href="#7.3.1" |
23575 | 23577 | <tr><td ><a href="#7-us_ltime">us_ltime(format[,offset])</a></td><td >integer</td><td >string</td></tr> |
23576 | 23578 | <tr><td ><a href="#7-us_utime">us_utime(format[,offset])</a></td><td >integer</td><td >string</td></tr> |
23577 | 23579 | <tr><td ><a href="#7-utime">utime(format[,offset])</a></td><td >integer</td><td >string</td></tr> |
| 23580 | +<tr><td ><a href="#7-when">when(condition)</a></td><td >any</td><td >same</td></tr> |
23578 | 23581 | <tr><td ><a href="#7-word">word(index,delimiters[,count])</a></td><td >string</td><td >string</td></tr> |
23579 | | -<tr><td ><a href="#7-wt6">wt6([avalanche])</a></td><td >binary</td><td >integer</td></tr> |
23580 | 23582 | <thead><tr><th>keyword</th><th>input type</th><th>output type</th></tr></thead> |
| 23583 | +<tr><td ><a href="#7-wt6">wt6([avalanche])</a></td><td >binary</td><td >integer</td></tr> |
23581 | 23584 | <tr><td ><a href="#7-x509_v_err_str">x509_v_err_str</a></td><td >integer</td><td >string</td></tr> |
23582 | 23585 | <tr><td ><a href="#7-xor">xor(value)</a></td><td >integer</td><td >integer</td></tr> |
23583 | 23586 | <tr><td ><a href="#7-xxh3">xxh3([seed])</a></td><td >binary</td><td >integer</td></tr> |
@@ -24963,7 +24966,68 @@ <h3 id="chapter-7.3.1" data-target="7.3.1"><small><a class="small" href="#7.3.1" |
24963 | 24966 | <span class="comment"># e.g. 20140710162350 127.0.0.1:57325</span> |
24964 | 24967 | log-format %[date,utime(%Y%m%d%H%M%S)]\ %ci:%cp |
24965 | 24968 | </code></pre> |
24966 | | -</div><a class="anchor" name="word"></a><a class="anchor" name="7-word"></a><a class="anchor" name="7.3.1-word"></a><a class="anchor" name="word (Using ACLs and fetching samples)"></a><a class="anchor" name="word (Converters)"></a><div class="keyword"><b><a class="anchor" name="word"></a><a href="#7.3.1-word">word</a></b>(<span style="color: #080"><index></span>,<span style="color: #080"><delimiters></span><span style="color: #008">[,<span style="color: #080"><count></span>]</span>)</div><pre class="text">Extracts the nth word counting from the beginning (positive index) or from |
| 24969 | +</div><a class="anchor" name="when"></a><a class="anchor" name="7-when"></a><a class="anchor" name="7.3.1-when"></a><a class="anchor" name="when (Using ACLs and fetching samples)"></a><a class="anchor" name="when (Converters)"></a><div class="keyword"><b><a class="anchor" name="when"></a><a href="#7.3.1-when">when</a></b>(<span style="color: #080"><condition></span>)</div><pre class="text">Evaluates the condition and when true, passes the input sample as-is to the |
| 24970 | +output, otherwise return nothing. This is designed specifically to produce |
| 24971 | +some rarely needed data that should only be emitted under certain conditions, |
| 24972 | +such as debugging information when an error is met. |
| 24973 | + |
| 24974 | +The condition is made of a keyword among the list below, optionally preceeded |
| 24975 | +by an exclamation mark ('!') to negate it: |
| 24976 | + |
| 24977 | + - "error" returns true when an error was encountered during the processing |
| 24978 | + of the request or stream. It uses the same rules as "<a href="#option%20dontlog-normal">dontlog-normal</a>" |
| 24979 | + (e.g. a successful redispatch counts as an error). |
| 24980 | + |
| 24981 | + - "<a href="#option%20forwarded">forwarded</a>" returns true when the request was forwarded to a backend |
| 24982 | + server |
| 24983 | + |
| 24984 | + - "normal" returns true when no error happened (this is equivalent to |
| 24985 | + "!error"). |
| 24986 | + |
| 24987 | + - "processed" returns true when the request was either forwarded to a |
| 24988 | + backend server, or processed by an applet. |
| 24989 | + |
| 24990 | + - "<a href="#stopping">stopping</a>" returns true if the process is currently stopping when the |
| 24991 | + rule is evaluated |
| 24992 | + |
| 24993 | + - "toapplet" returns true when the request was processed by an applet. |
| 24994 | + |
| 24995 | +Note that the content is evaluated in any case, so doing this does not avoid |
| 24996 | +the generation of that information. It's only meant to avoid producing that |
| 24997 | +information. |
| 24998 | + |
| 24999 | +An example would be to add backend stream debugging information in the logs |
| 25000 | +only when an error was encountered during processing, or logging extra |
| 25001 | +information when stopping, etc. |
| 25002 | +</pre><div class="separator"> |
| 25003 | +<span class="label label-success">Example:</span> |
| 25004 | +<pre class="prettyprint"> |
| 25005 | +<code><span class="comment"># log "dbg={-}" when fine, or "dbg={... debug info ...}" on error:</span> |
| 25006 | +log-format "$HAPROXY_HTTP_LOG_FMT dbg={%[bs.debug_str,when(!normal)]}" |
| 25007 | + |
| 25008 | +Here, the "dbg" field in the log will only contain an dash ('-') to |
| 25009 | +indicate a missing content when the rule is not validated, and will emit a |
| 25010 | +whole debugging block when it is. |
| 25011 | +</code></pre> |
| 25012 | +</div><pre class="text">Example |
| 25013 | + # only emit the backend src/port when a real connection was issued: |
| 25014 | + log-format "$HAPROXY_HTTP_LOG_FMT \ |
| 25015 | + src=[%[bc_src,when(forwarded)]:%[bc_src_port,when(forwarded)]]" |
| 25016 | + |
| 25017 | +Since it kills the evaluation of the expression when it is not true, it is |
| 25018 | +also possible to use it to stop a subsequent converter from being called. |
| 25019 | +This may for example be used to call the debug() converter only upon error, |
| 25020 | +to log an element only when absolutely necessary. |
| 25021 | +</pre><div class="separator"> |
| 25022 | +<span class="label label-success">Example:</span> |
| 25023 | +<pre class="prettyprint"> |
| 25024 | +<code><span class="comment"># emit the whole response headers list to stderr only on error and only</span> |
| 25025 | +<span class="comment"># when the output is a connection. We abuse a dummy variable here.</span> |
| 25026 | +http-after-response set-var(res.test) \ |
| 25027 | + res.hdrs,when(error),when(forwarded),debug(hdrs,stderr) |
| 25028 | +</code></pre> |
| 25029 | +</div><div class="page-header"><b>See also:</b> debug converter</div> |
| 25030 | +<a class="anchor" name="word"></a><a class="anchor" name="7-word"></a><a class="anchor" name="7.3.1-word"></a><a class="anchor" name="word (Using ACLs and fetching samples)"></a><a class="anchor" name="word (Converters)"></a><div class="keyword"><b><a class="anchor" name="word"></a><a href="#7.3.1-word">word</a></b>(<span style="color: #080"><index></span>,<span style="color: #080"><delimiters></span><span style="color: #008">[,<span style="color: #080"><count></span>]</span>)</div><pre class="text">Extracts the nth word counting from the beginning (positive index) or from |
24967 | 25031 | the end (negative index) considering given delimiters from an input string. |
24968 | 25032 | Indexes start at 1 or -1 and delimiters are a string formatted list of chars. |
24969 | 25033 | Empty words are skipped. This means that delimiters at the start or end of |
@@ -31205,7 +31269,7 @@ <h2 id="chapter-11.3" data-target="11.3"><small><a class="small" href="#11.3">11 |
31205 | 31269 | <br> |
31206 | 31270 | <hr> |
31207 | 31271 | <div class="text-right"> |
31208 | | - HAProxy 3.1-dev10-40 – Configuration Manual<br> |
| 31272 | + HAProxy 3.1-dev10-50 – Configuration Manual<br> |
31209 | 31273 | <small>, 2024/10/16</small> |
31210 | 31274 | </div> |
31211 | 31275 | </div> |
|
0 commit comments