1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><title>nomatch mode - property replacer - rsyslog.conf</title></head>
4
<h1>nomatch mode - property replacer - rsyslog.con</h1>
5
<p>This is a part of the <a href="rsyslog_conf.html">rsyslog.conf documentation</a>
6
of the <a href="property_replacer.html">property replacer</a>.</p>
7
<p><b>The "nomatch-Mode" specifies which string the property replacer
8
shall return if a regular expression did not find the search string.</b>. Traditionally,
9
the string "**NO MATCH**" was returned, but many people complained this was almost never useful.
10
Still, this mode is support as "<b>DFLT</b>" for legacy configurations.
11
<p>Three additional and potentially useful modes exist: in one (<b>BLANK</b>) a blank string
12
is returned. This is probably useful for inserting values into databases where no
13
value shall be inserted if the expression could not be found.
14
<p>A similar mode is "<b>ZERO</b>" where the string "0" is returned. This is suitable
15
for numerical values. A use case may be
16
that you record a traffic log based on firewall rules and the "bytes transmitted" counter
17
is extracted via a regular expression. If no "bytes transmitted" counter is available
18
in the current message, it is probably a good idea to return an empty string, which the
19
database layer can turn into a zero.
20
<p>The other mode is "<b>FIELD</b>", in which the complete field is returned. This may be useful
21
in cases where absense of a match is considered a failure and the message that triggered
23
<p>If in doubt, <b>it is highly suggested to use the
24
<a href="http://www.rsyslog.com/tool-regex">rsyslog online regular expression
25
checker and generator</a> to see these options in action</b>. With that online tool,
26
you can craft regular expressions based on samples and try out the different modes.
28
<h2>Summary of nomatch Modes</h2>
29
<table border="1" cellspacing="0">
30
<tr><td><b>Mode</b></td><td><b>Returned</b></td></tr>
31
<tr><td>DFLT</td><td>"**NO MATCH**"</td></tr>
32
<tr><td>BLANK</td><td>"" (empty string)</td></tr>
33
<tr><td>ZERO</td><td>"0"</td></tr>
34
<tr><td>FIELD</td><td>full content of original field</td></tr>
35
<tr><td> </td><td><a href="http://www.rsyslog.com/tool-regex">Interactive Tool</a></td></tr>
37
<p>[<a href="manual.html">manual index</a>]
38
[<a href="rsyslog_conf.html">rsyslog.conf</a>]
39
[<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
40
<p><font size="2">This documentation is part of the
41
<a href="http://www.rsyslog.com/">rsyslog</a> project.<br>
42
Copyright © 2008 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
43
<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL
44
version 2 or higher.</font></p>