Raw Log Search Query Syntax
Updated Sep 19, 2023Raw Log Search
Raw Log Search is a licensed Managed Detection and Response (MDR) add-on feature that lets you search the Arctic Wolf platform, which stores an aggregation of raw log data from your on-premises systems and cloud services. This feature allows you to retrieve logs in raw format for operational and security-related tasks, such as validating a configuration change or investigating a security alert.
Tip: You can also search the Arctic Wolf observation pipeline for parsed and analyzed event logs. See View event logs in the Arctic Wolf Unified Portal User Guide for details.
Search expression syntax
In Raw Log Search, you can write a complex search expression to run a refined search. A complex search expression includes conditional logic that is designed to limit the number of matches. This logic is expressed as a combination of search words and operators.
The syntax, or rules, for writing a complex search expression is as follows:
- Search expressions rely on exact matching, including whitespaces, quotation marks, and special characters.
- Search expressions are case-sensitive by default. You can deselect the Case sensitive option to ignore capitalization.
- A search expression can include these search operators:
AND
,OR
,NOT
, and( )
. See Search operators for more information. You must include a single space character on both sides of the AND, OR, and NOT operators, and you must write these operators in all capital letters. - A search expression can have no more than 10 operators.
- A search expression must contain at least 2 non-whitespace characters. Search expressions with only one non-whitespace character, such as
a
orb
, are invalid. - A search expressions must not contain more than 1000 characters including whitespace characters. Search expressions that exceed this length are invalid. Note that UTF-8 characters, such as an mathematical symbol, may count as multiple characters.
- Wildcard characters such as
*
or?
are not supported. Since all search expressions are substring matched, the*
wildcard character is already implied on either side of the search word. For example, searching forerror
is equivalent to searching for*error*
. - Raw logs from some log sources include tab characters. Tab characters are searchable. See Tab character searches for more information.
- Some characters are reserved. Search expressions that contain reserved characters are invalid. See Reserved characters.
Query templates
Using a query template is a way of ensuring that a search expression has the correct syntax. In Raw Log Search, you can choose from a list of frequently run searches to add a search expression to the Search field. See Run a search in the Raw Log Search User Guide for detailed steps.
Tip: Start with a query template that is similar to the search you want to run. Then, modify the search expression as desired.
Search operators
These are the available search operators and their uses:
Operator | Description |
---|---|
AND | The AND operator separates individual search terms, requiring that both are present in any order in the log line. |
OR | The OR operator separates individual search terms, and returns results where either term is present anywhere in the log line. |
NOT | The NOT operator excludes the search term(s) from the results that follow NOT in the search expression. |
( ) | The parentheses operator is used to control the order of operations when you use multiple operators in your search expression. Without parentheses, the default precedence is NOT , followed by AND then OR .To search for parentheses contained within log data, you must use the backslash, \ , character to escape the parentheses operation in your search expression. |
For example:
NOT aa OR bb AND cc
is a valid search expression to find records that do not contain'aa'
, or contain both'bb'
and'cc'
in any order.NOT aa OR bb AND cc
is equivalent to(NOT aa) OR (bb AND cc)
.
You must include a single space character on both sides of the AND, OR, and NOT operators, and you must write these operators in all capital letters.
A search expression can have up to 10 operators.
Tab character searches
Include tab whitespace characters in your search expression if you want to search for a Microsoft Event Log that is formatted with a tab whitespace character, 0x09
, on either side of the event code. For example, the login failure code 4625 includes tab characters. This prevents the search expression from matching other sequences that contain 4625, like timestamps or UUIDs. You can add a tab whitespace character into the search field using the Indent option on the search bar.
For example, to search for all login attempts, failed or successful for jsmith
, search for:
MSWinEventLog AND ( 4624 OR 4625 ) AND jsmith
Note that there is a tab whitespace character before and after each event code, and a single space on either side of the OR operator.
Reserved characters
There are reserved characters that you cannot use in search expressions. Search expressions that contain any of the following characters are invalid:
- The line feed/new line character,
0x0A
, often represented as\n
. - The carriage return character,
0x0D
, often represented as\r
. - The vertical tab character,
0x0B
, often represented as\v
. - The form feed character,
0x0C
, often represented as\f
. - The shift out and shift in characters,
0x0E
and0x0F
.
This list of reserved characters is subject to change based on system requirements or technical restrictions. Changes are usually applied for non-printable characters in the low-ASCII range, 0x00
to 0x1F
or high UTF-8 range.
Examples of log search expressions
The following examples illustrate how you can modify your search expression syntax to refine your search:
Search expression | Anticipated search result | Match | Description |
---|---|---|---|
error code: 400 |
Authorization failed with error code: 400 | Yes | There is an exact match for the search string in the log line. |
error code: 400 |
Aborted operation returned error code: 4009217 | Yes | Although extra characters follow the search term, there is an exact substring match. |
error code: 400 |
HTTP request failure error code: 400 | No | The character following the colon is a tab character, 0x09 , and not a space, 0x20 in the raw log line, and therefore does not match the search expression. |
error code: 400 |
HTTP request failure error code: 400 | No | There are two spaces, instead of a single space, following the colon in the raw log line, so there is not an exact match to the search expression. |
error code: 400 |
Device code error: 400 | No | All words are present in the log line, but the order of the words do not match the search expression. |
jsmith AND (failed login) |
ERROR:: failed login for user: jsmith | Yes | The query matches logs that contain jsmith and the exact phrase failed login , including whitespace. |
jsmith AND (fail OR denied) |
ERROR:: failed login for user: jsmith | Yes | The first search term and only one of the OR terms appear in the search results. Note: The word fail is a substring of failed since wildcards on both sides of a search string are implied. |
jsmith AND (fail OR denied) |
Permission denied to 'jsmith' attempting deletion of object 0x943150897 | Yes | The first search term and one of the OR terms appear in the search results. |
jsmith AND (fail OR denied) |
Login denied: user 'ajsmith' failed verification question | Yes | All the search terms appear in the log line. |
HTTP (404) |
HTTP (404) POST /widgets/missing | No | Invalid syntax because the parentheses function as operators in this search expression. This syntax returns an error similar to Query contains syntax error(s): 'HTTP (404)' at position: 6 . Tip: Add backslash characters to render the parentheses in this search expression as normal characters in the search string. |
HTTP \(404\) |
HTTP (404) POST /widgets/missing | Yes | The search string appears in the log line. |
"failed login" |
ERROR:: "failed login" | Yes | The query only matches logs that contain the exact terms, including whitespace and quotes. |
Get help
- If you have questions about Raw Log Search, contact your Concierge Security® Team (CST).