A filter pattern defines the character string or expression that you want to match in the step output. Each filter pattern you create is associated with a single filter action. Both filter patterns and actions are defined in the filter log sets. The ability to include multiple filter patterns in a log filter and apply it to output from a single step allows you to use multiple search criteria without constructing complex expressions.
To create a log filter, select Log filters.
. For details, seeReview these guidelines for creating filter patterns:
Syntax for some standard regular expressions are shown in the following table.
Expression |
Matches |
---|---|
Production |
Matches Production anywhere in the string. |
^Production |
Matches Production at the beginning of the string. |
Error:.*[0-9]$ |
Matches a line that contains Error followed by any set of characters terminated by a number at the end of the string. |
[Ww]arning |
Matches Warning or warning. |
.* |
Matches any character 0 or more times. The dot (.) matches any character, and the asterisk (*) matches 0 or more times. |
To construct a pattern filter, it is important to understand how the system searches for pattern matches.
For each line of output, the system checks for matches against all the filter patterns in order; it stops when it finds a match, and moves on to the next pattern. So, if the pattern occurs twice on one line, the system might not find it. For example, consider this line of output:
exception retrying exception
Using the filter patterns in the following table, the system matches the first exception, sets the step result to Fail, matches retrying and sets the step result to Pass, and moves on to the next line without matching the second exception.
Filter patterns | Filter actions | Example description |
---|---|---|
[Ee]xception [Rr]etrying | Set Fail - Fail Clear Fail - Pass | This pattern is useful for Java projects; it fails the step on exceptions, but clears the failure on a retry. If the retry fails, a new exception is generated so that the final state of the command is valid. |
One way to resolve this problem is to replace the filter patterns in the table with the following filter pattern:
retrying.*exception