<html><head></head><body>Hi,<br>
<br>
Yeah, we should probably do that.<br>
-- <br>
Bazsi<br><br><div class="gmail_quote">On April 29, 2014 11:41:44 AM GMT+01:00, Gergely Nagy &lt;algernon@balabit.hu&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">David Hauck &lt;davidh@netacquire.com&gt; writes:<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> I was wondering if there was a way to specify default values for<br /> pattern DB parsers that include a value, but where the parsed value is<br /> &lt;null&gt;[/empty]?<br /><br /> In particular if I have something like the following:<br /><br />           &lt;pattern&gt;test message; field1=@ESTRING:field1: @field2=@ESTRING:field2: @field3=@ESTRING:: @field4=@ESTRING:field4: @&lt;/pattern&gt;<br /><br /> I'd like to be able to do something like either, 1:<br /><br />           &lt;pattern&gt;test message; field1=@ESTRING:field1&lt;foo&gt;: @field2=@ESTRING:field2&lt;bar&gt;: @field3=@ESTRING:: @field4=@ESTRING:field4&lt;beef&gt;: @&lt;/pattern&gt;<br /><br /> Or 2:<br /><br />           &lt;pattern&gt;test message; field1=@ESTRING:field1: @field2=@ESTRING:field2: @field3=@ESTRI
 NG::
@field4=@ESTRING:field4: @&lt;/pattern&gt;<br />         &lt;values&gt;<br />           &lt;value name="field1.default"&gt;foo&lt;/value&gt;<br />           &lt;value name="field2.default"&gt;bar&lt;/value&gt;<br />           &lt;value name="field4.default"&gt;beef&lt;/value&gt;<br /><br /> Just curious...<br /></blockquote><br />You can use ${field1:-foo} in templates, to set a default if none is<br />set. It doesn't work for empty fields, though, but that can be worked<br />around with an $(if $(length $field1) eq 0 "default" $field1) template,<br />possibly in a rewrite rule.<br /><br />Though, maybe ${field1:-foo} should work for empty values too, not just<br />unset ones (to mimic shell better, which does just that). I can make it<br />do so, if that'd be desired, would make it unnecessary to use the $(if)<br />hack.<br /><br />@Bazsi: What do you think?<br /></pre></blockquote></div></body></html>