<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 <algernon@balabit.hu> 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 <davidh@netacquire.com> 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 /> <null>[/empty]?<br /><br /> In particular if I have something like the following:<br /><br /> <pattern>test message; field1=@ESTRING:field1: @field2=@ESTRING:field2: @field3=@ESTRING:: @field4=@ESTRING:field4: @</pattern><br /><br /> I'd like to be able to do something like either, 1:<br /><br /> <pattern>test message; field1=@ESTRING:field1<foo>: @field2=@ESTRING:field2<bar>: @field3=@ESTRING:: @field4=@ESTRING:field4<beef>: @</pattern><br /><br /> Or 2:<br /><br /> <pattern>test message; field1=@ESTRING:field1: @field2=@ESTRING:field2: @field3=@ESTRI
NG::
@field4=@ESTRING:field4: @</pattern><br /> <values><br /> <value name="field1.default">foo</value><br /> <value name="field2.default">bar</value><br /> <value name="field4.default">beef</value><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>