Error
Recognizes any message
containing the keyword Error
at any place in the
message. (It is case sensitive by default.)
panic
Matches all messages containing panic
,
Panic
, PANIC
at any place in the text,
when case sensitive mode is switched off.
logon
|logoff
Uses the OR operator to recognize any message
containing the keyword logon
or
logoff
.
^getty:<*.msg>
errno<*><#.errnum>$
Recognizes any message such as: getty: cannot open ttyxx
errno : 6
-Or- getty: can't open ttyop3; errno
16
In the example getty: cannot open ttyxx errno : 6
,
the string "cannot open ttyxx" is assigned to the variable
msg. The digit 6 is assigned to the variable
errnum. Note that the dollar sign ($) is used as
an anchoring symbol to specify that the digit 6 will only be
matched if it is at the end of the line.
^errno[ |=]<#.errnum> <*.errtext>
Matches messages such as: errno 6 - no such device or
address
-Or- errno=12 not enough core
.
Note the space before the OR operator. The expression in square brackets matches either this blank space, or the "equals" sign. The space between <#.errnum> and <*.errtext> is used as a delimiter. Although not strictly required for assignments to the variables shown here, this space serves to increase performance.
^hugo:<*>:<*.uid>:
Matches any /etc/passwd entry for user
hugo
and returns the user ID to variable
uid. Notice that ":" in the middle of the pattern
is used to delimit the string passed to uid from
the preceding string. The colon ":" at the end of the pattern is
used to delimit the string passed to uid from the
succeeding group ID in the input pattern. Here, the colon is
necessary not only as a speed enhancement, but also as a means of
logical separation between strings.
^Warning:<*.text>on node<@.node>$
Matches any message such as: Warning: too many users on
node hpbbx
and assigns too many users
to
text, and hpbbx
to
node.
<<#> -le 45>
This pattern matches all strings containing a number which is less than or equal to 45. For example, the message: ATTENTION: Error 40 has occurred would be matched.
Note that the number 45 in the pattern is a true numeric value and not a string. Numbers higher than 45, for instance, "4545" will not be matched even if they contain the combination, "45".
<15 -lt <2#> -le 87>
This pattern matches any message in which the first two digits of a number are within the range 16-87. For instance, the message: Error Message 3299 would be matched. The string: Error Message 9932 would not be matched.
^ERROR_<[<#.err>] -le 57>
This pattern matches any text starting with the string "ERROR_" immediately followed by a number less than, or equal to, 57.
For example, the message: ERROR_34: processing stopped would be matched and the string 34 would be assigned to the variable, err.
<120 -gt [<#>1] -gt 20>
Matches all numbers between 21 and 119 which have 1 as their last digit. For instance, messages containing the following numbers would be matched: 21, 31, 41... 101... 111 and so on.
Temperature <*> <@.plant>:
<<#> -gt 100> F$
This pattern matches strings such as: "Actual Temperature in Building A: 128 F". The letter "A" would be assigned to the variable, plant.
Error <<#> -eq 1004>
This pattern matches any message containing the string "Error" followed by a space and the sequence of digits, "1004".
For example, Warning: Error 1004 has occurred would be matched by this pattern. However, Error 10041 would not be matched by this pattern.
WARNING <<#> -ne 107>
This pattern matches any message containing the string "WARNING" followed by a space and any sequence of one or more digits, except "107". For example, the message: Application Enterprise (94/12/45 14:03): WARNING 3877 would be matched.
Related Topics: