Substitution rule examples
Using the Positions, Match and Substitution fields
The following examples illustrate how to use the Positions, Match
and Substitution fields of a substitution rule.
- Substitution rule to retrieve msg attribute value with separator
token and designation token specified.
Log record:
<March 14, 2004 10:25:21 EST> application:myapp severity:3
instance:01 message:WARNING-file style.css missing
Rule specifications:
Separator Token= []{2}
Designation Token= :
Postions=$h('message')
Match=(.*)
Substitution=$1
Resulting value assigned to the msg attribute:
WARNING-file style.css missing
- Substitution rule to retrieve msg attribute value with only
separator token specified.
Log record:
<March 14, 2004 10:25:21 EST>;myapp;3;01;WARNING-file
style.css missing
Rule specifications:
Separator Token=;
Designation Token=
Positions= 5
Match= (.*)
Substitution= $1
Resulting value assigned to the msg attribute:
WARNING-file style.css missing
- Substitution rule to retrieve msg attribute value with only
separator token specified.
Log record:
<March 14, 2004 10:25:21 EST>;myapp;3;01;WARNING;file
style.css missing
Rule specifications:
Separator Token=;
Designation Token=
Positions= 5@@6
Match= (.*)@@(.*)
Substitution= $1-$2
Resulting value assigned to the msg attribute:
WARNING-file style.css missing
Using the Time Format field
The following examples illustrate how to use the Time Format
field of a substitution rule.
- Substitution rule to retrieve creationTime attribute value with no
separator or designation token specified.
Log record:
<March 14, 2004 10:25:21 EST> myapp 3 01 WARNING file
style.css missing
Rule specifications:
Separator Token=
Designation Token=
Positions=
Match= ^<(.*)>.*
Substitution= $1
Time Format= MMMM dd, yyyy hh:mm:ss z
Resulting value assigned to the creationTime attribute:
2004-03-14T15:25:21.000Z
Parent topic: Creating
a rules-based adapter
Copyright © 2005 IBM Corporation. All rights reserved. This document
and the accompanying materials are made available under the terms of the
Eclipse Public License v1.0 which is
available at http://www.eclipse.org/legal/epl-v10.html