~arges/ubuntu/quantal/rsyslog/fix-lp1059592

« back to all changes in this revision

Viewing changes to doc/property_replacer.html

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-02-15 21:56:23 UTC
  • mto: (3.2.4 squeeze) (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090215215623-xsycf628eo3kguc0
Tags: upstream-3.20.4
ImportĀ upstreamĀ versionĀ 3.20.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
<td><b>fromhost</b></td>
45
45
<td>hostname of the system the message was received from
46
46
(in a relay chain, this is the system immediately in front of us and
47
 
not necessarily the original sender)</td>
 
47
not necessarily the original sender). This is a DNS-resolved name, except
 
48
if that is not possible or DNS resolution has been disabled.</td>
 
49
</tr>
 
50
<tr>
 
51
<td><b>fromhost-ip</b></td>
 
52
<td>The same as fromhost, but alsways as an IP address. Local inputs
 
53
(like imklog) use 127.0.0.1 in this property.</td>
48
54
</tr>
49
55
<tr>
50
56
<td><b>syslogtag</b></td>
198
204
property replacer will return the part of the property text that
199
205
matches the regular expression. An example for a property replacer
200
206
sequence with a regular expression is: "%msg:R:.*Sev:. \(.*\)
201
 
\[.*--end%"<br>
202
 
</p>
 
207
\[.*--end%"</p>
 
208
<p>It is possible to specify some parametes after the "R". These are
 
209
comma-separated. They are:
 
210
<p>R,&lt;regexp-type&gt;,&lt;submatch&gt;,&lt;nomatch&gt;,&lt;match-number&gt;
 
211
<p>regexp-type is either "BRE" for Posix basic regular expressions or
 
212
"ERE" for extended ones. The string must be given in upper case. The
 
213
default is "BRE" to be consistent with earlier versions of rsyslog that
 
214
did not support ERE. The submatch identifies the submatch to be used
 
215
with the result. A single digit is supported. Match 0 is the full match,
 
216
while 1 to 9 are the acutal submatches. The match-number identifies which match to
 
217
use, if the expression occurs more than once inside the string. Please note
 
218
that the first match is number 0, the second 1 and so on. Up to 10 matches
 
219
(up to number 9) are supported. Please note that it would be more
 
220
natural to have the match-number in front of submatch, but this would break 
 
221
backward-compatibility. So the match-number must be specified after "nomatch".
 
222
<p>nomatch is either "DFLT", "BLANK", ZERO or "FIELD" (all upper case!). It tells
 
223
what to use if no match is found. With "DFLT", the strig "**NO MATCH**" is
 
224
used. This was the only supported value up to rsyslog 3.19.5. With "BLANK"
 
225
a blank text is used (""). With "ZERO", "0" is used.
 
226
Finally, "FIELD" uses the full property text
 
227
instead of the expression. Some folks have requested that, so it seems
 
228
to be useful.
 
229
<p>The following is a sample of an ERE expression that takes the first
 
230
submatch from the message string and replaces the expression with
 
231
the full field if no match is found:
 
232
<p>%msg:R,ERE,1,FIELD:for (vlan[0-9]*):--end%
 
233
<p>and this takes the first submatch of the second match of said expression:
 
234
<p>%msg:R,ERE,1,FIELD,1:for (vlan[0-9]*):--end%
 
235
<p><b>Please note: there is also a
 
236
<a href="http://www.rsyslog.com/tool-regex">rsyslog regular expression checker/generator</a>
 
237
online tool available.</b> With that tool, you can check your regular expressions and
 
238
also generate a valid property replacer sequence. Usage of this tool is recommended.
 
239
Depending on the version offered, the tool may not cover all subleties that can
 
240
be done with the property replacer. It concentrates on the most often used cases. So it
 
241
is still useful to hand-craft expressions for demanding environments.
203
242
<p><b>Also, extraction can be done based on so-called
204
243
"fields"</b>. To do so, place a "F" into FromChar. A field in its
205
244
current definition is anything that is delimited by a delimiter
253
292
<td>format as RFC 3339 date</td>
254
293
</tr>
255
294
<tr>
 
295
<td><b>date-subseconds</b></td>
 
296
<td>just the subseconds of a timestamp (always 0 for a low precision timestamp)</td>
 
297
</tr>
 
298
<tr>
256
299
<td valign="top"><b>escape-cc</b></td>
257
300
<td>replace control characters (ASCII value 127 and values
258
301
less then 32) with an escape sequence. The sequnce is
312
355
</tr>
313
356
</tbody>
314
357
</table>
 
358
<p>To use multiple options, simply place them one after each other with a comma delmimiting
 
359
them. For example "escape-cc,sp-if-no-1st-sp". If you use conflicting options together,
 
360
the last one will override the previous one. For example, using "escape-cc,drop-cc" will
 
361
use drop-cc and "drop-cc,escape-cc" will use escape-cc mode.
315
362
<h2>Further Links</h2>
316
363
<ul>
317
364
<li>Article on "<a href="rsyslog_recording_pri.html">Recording