A filter pattern defines the character string or expression that you want to match in step output. Each filter pattern you create is associated with a single filter action. Both filter patterns and actions are defined in 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 Creating a Log Filter.
. 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 the 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 0 or more of any character. The dot (.) matches any character, and the asterisk (*) matches any character 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 may not find it.
exception retrying exception
For example, using the previous line of step output and the filter patterns in the following table, the system would match the first exception, set the step result to Fail, match retrying and set the step result to Pass, and move on to the next line without matching the second exception.
One way to resolve this problem is to replace the filter patterns in the table with the following filter pattern:
retrying.*exception
Filter Patterns | Filter Actions | Example Description |
---|---|---|
[Ee]xception [Rr]etrying | Set Fail - Fail Clear Fail - Pass | This 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 will be generated, so that the final state of the command is valid. |