Match expressions


Create BMC Defender Server match expressions with simple keywords, keywords and wildcards, or more complex expressions that use AND, OR, XOR, and NOT conjunctives. Expressions can contain parenthetical nesting to change the order of evaluation.

Match expression types

The following table describes different types of expressions:

Expression type

Description

Case insensitive matches

All matches are case insensitive.

Example

The expression test matches test, Test, TEST, or any combination of upper and lower case characters.

Partial matches to keywords

Matches can be partial.

Example

The expression fail matches failure and nofail or any occurrence of the keyword fail within the message.

Wildcard matches

Any keyword can contain the following wildcard:

  • *—Match zero or more occurrences of a string
  • ?—Match a single character
  • ^—Match the beginning of the line

Literal matches

To match a literal string, the string must be enclosed in quotes. Single or double quotes can be used. Also any single keyword or wildcard expression can be quoted, (although this is generally not necessary unless the keyword or wildcard contains space characters).

Example

The expression "log off" matches any occurrence of log off in a string, including the space character.

AND operator

To require various keywords in the message, use the AND operator. 

Example

The expression login AND user matches only if the keyword login and the keyword user both occur in the message.

OR operator

To require a selection of keywords in the message, use the OR operator.

Example

The expression login OR logon matches a message that contains the keyword login or the keyword logon.

XOR operator

To require either of the two keyword, but not both, use the XOR operator.

Example

The expression login XOR logon matches a message that contains the keyword login or the keyword logon, but not both.

NOT operator

To negate a keyword, prefix it with the NOT operator.

Example

The expression NOT login matches any message that does not contain the keyword login. Similarly, the expression login AND NOT system matches a message that contains the keyword login, and does not contain the keyword system.

Parenthetical nesting

More complex expressions can be constructed using parentheses to determine the order of evaluation.

Example

The expression (login OR logon) AND (system OR windows) matches messages with login system, login windows, logon system, and logon windows.

Field matches

Parenthetical terms can include matches to specific fields. BMC Defender Server permits both the in and eq operators in field matches

Examples

The expression (A IN $5) matches messages with in the fifth word of the message portion of the input line.

The expression ($5 EQ XXX) requires the fifth word of the message to precisely match XXX.

The expression (ZZZ IN $12) requires the keyword ZZZ to appear in the twelfth word of the message.

Parsed field matches

Expressions can contain special parser functions that match a particular field only if the field has a property such as an email address, number, URL, and geographical location. 

Match expression examples

The match expression types permit a wide degree of flexibility in matching input lines. Some examples of these rules are shown as follows:

Expression

Description

Hello

Match any occurrence of Hello, hello, or HELLO in the input line

NOT Hello

Match any line that does not contain an occurrence of hello. All matches are case insensitive

"Hello World"

Match any occurrence of Hello World in the input line, including spaces

The pattern must be enclosed in balanced single or double quote marks because the pattern contains a space.

Hello*World

Matches Hello World, Hello There World, and any other input line containing Hello, followed by any number of characters, followed by World

Because the keyword contains no spaces, quotation marks are optional.

Hello OR World

Matches any line that contains the keyword Hello, or the keyword World, or both, in any order

Hello XOR World

Matches any line that contains the keyword Hello, or the keyword World, but not both

Hello AND NOT World

Matches any line that contains the keyword Hello, except for those lines that also contain the keyword World

NOT (Hello or World)

Matches any line that does not contain the keyword Hello or the keyword World

(NOT Hello) AND (NOT World)

Identical to the previous expression, matches any line that does not contain the keyword Hello and also does not contain the keyword World

(Hello EQ $7)

Matches any line where the seventh word of the message is Hello delimited by white space,

NOT (World IN $5)

Matches any line where the fifth word of the message does not contain the keyword World delimited by white space,

Important

The IN operator permits partial matches, but otherwise operates similarly to the EQ operator.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*