The contains and regex filters provide you with wildcard capabilities on both index string data and non-indexed string data. These filters have syntax requirements.
Use the contains and regex filters in any text or string field. The case insensitivity icon
next to filter field names denotes text fields. Other fields that allow the contains filter do not have that icon.
Syntax Examples
Syntax for contains is contains(somevalue) and for regex is regex(someregularexpression).
To make the filters case insensitive, click
or include the /i regular expression notation, as in regex(/somevalue/i). The search results return values that contain somevalue, regardless of case.
The NOT
and
icons apply to contains and regex values. To show the values in the search results without a value, enter the value and click the
icon. If you want the results to show one value or another, enter the values and click
.
Example #1 — A simple search
Indexed fields: |
|
Non-indexed fields: |
|
Result: | Returns strings with |
Example #2 — An OR search
Indexed fields: |
|
Non-indexed fields: |
|
Result: | Returns strings in the field that contain admin or NGCP. The regex OR requires the extra set of parentheses to function. |
Example #3 — A search for special characters, such as in service accounts
A dollar sign:
Important
To make the filter work, you must use the ASCII code \x24 for a dollar sign.
Indexed fields: |
|
Non-indexed fields: |
|
Result: | Either statement returns strings in the field that contain a dollar sign |
With regex, if you try to use the \x24 without scaling it, the result set returns empty. PCRE escape sequence is a better search method to use.
A percent sign:
Indexed fields: |
|
Non-indexed fields: |
|
A backslash:
Indexed fields: |
|
Non-indexed fields: |
|
Dual back slashes
Indexed fields: |
|
Non-indexed fields: |
|
Note
If you do not use the HEX value or the slash with regex, the Invalid Regular Expression (ER5-0015) error can occur.
Example #4 — Search using the * wildcard
Indexed fields: |
|
Non-indexed fields: |
|
Results: | Returns any string that starts with |
Example #5 — Search using Regular Expression
These domains are from Microsoft DNS events.
| |
| |
| |
| |
| |
| |
Results: | This regular expression picks out a specific string. In this case, its |
Caveats
To avoid higher overhead and slower query performance, use
regexwith values with a minimum of three characters.This filter can't be used in correlation rules or alarms. The only exception is that it can be used in correlation rules with name/value custom types.
Using
containsorregexwith NOT can cause higher overhead and slower query performance.Familiarity with bloom filters is recommended.