Skip to content

Advanced log query syntax

Open the Logs Explorer and select Advanced above the query panel. Switching from Simple converts the current free-text search and filters into an advanced query. A converted contains filter can return different results because advanced : queries use analyzed phrase matching.

Select Search to run the query. You can also press Ctrl+Enter on Windows or Linux, or Command+Enter on macOS. The editor completes field names from the current log index and shows each field’s mapped type. Enter values manually; value completion is not available.

Switching back to Simple asks for confirmation and discards the advanced query. Osuite does not convert an advanced query back into simple filters.

An advanced query contains field predicates, bare words, or groups joined by explicit Boolean operators. Boolean keywords are case-insensitive.

SyntaxMeaning
a and bMatch both expressions.
a or bMatch either expression.
not aExclude matches for the expression.
(a or b) and cEvaluate the parenthesized expression first.

Precedence is not, then and, then or. For example, this syntax-only expression is read as a:1 or (b:2 and (not c:3)):

a:1 OR b:2 AnD NoT c:3

Replace a, b, and c with fields offered by the editor. Parentheses override precedence:

(a:1 or b:2) and c:3

Operators must be explicit. Two adjacent expressions are invalid:

timeout error

Write timeout and error instead.

QueryBehavior
body:errorAnalyze error and phrase-match the body text field.
resource.service.name=cartMatch the exact value cart.
body!=ERRORExclude records whose exact body value is ERROR.
duration > -1Match values greater than -1.
duration>=100Match values greater than or equal to 100.
duration<200.5Match values less than 200.5.
duration<=250Match values less than or equal to 250.
duration:[100 to 200]Match the inclusive range from 100 through 200.
body:*Match records where body exists.
not body:*Match records where body does not exist.
timeoutPhrase-match timeout against body.
"request timed out"Phrase-match the quoted text against body.

Whitespace around operators is optional. Range keywords and Boolean keywords are case-insensitive, so this is valid:

@timestamp:[0 TO 9999999999999]

Use : for analyzed matching. On a text field, Osuite uses phrase matching, so all analyzed terms must occur as a phrase. On numeric, date, Boolean, and unquoted keyword values, : uses a typed exact match.

Use = for an exact match. When the selected field is mapped as text and has a .keyword subfield, Osuite targets that subfield. If no .keyword subfield exists, it targets the selected field. != uses the same field selection and value coercion as =, then excludes the match.

A quoted value used with : is a phrase match on string fields:

body:"request timed out"

Wildcards are available only on string fields and only as one trailing *:

body:time*

With :, trailing wildcard matching is case-insensitive and targets the selected field. With =, it follows exact field selection and is case-sensitive:

body=time*

Leading and embedded wildcards are invalid. Use analyzed matching instead of a leading wildcard. For example, use body:timeout, not body:*timeout*.

Select field names from the editor’s completion list. A field must exist in the current index mapping; an unknown field returns an error and, when possible, the nearest field-name suggestion.

Quote a value when it contains whitespace or query punctuation:

body:"request timed out"

Inside a quoted value, the only supported escapes are \" for a double quote and \\ for a backslash. This query matches the decoded value a\b"c:

body:"a\\b\"c"

Other backslash escapes are invalid. Unquoted values cannot contain whitespace, double quotes, parentheses, square brackets, operator characters (:, =, !, <, >), or * except as the single trailing wildcard.

Osuite coerces values according to the mapped field type:

Field typeAccepted values
IntegerBase-10 integers such as 12 and -1.
Floating pointFinite numbers such as 1.25.
DateInteger timestamp values. Use the time picker for the normal log time window.
Booleantrue or false, case-insensitive.
StringText as written, after supported quoted escapes are decoded.

These typed predicates are valid when the fields have the corresponding mappings:

ratio=1.25
enabled:true
@timestamp>=1700000000000
enabled:[false to true]

The comparison operators >, >=, <, <=, and inclusive [low to high] ranges are supported only on numeric, date, and Boolean fields. String ranges are rejected. Wildcards are rejected on non-string fields.

Find error logs, excluding an exact service name:

severity.text:error and not resource.service.name=cart

Match either a body phrase or a keyword value:

body:error or tag:api

Match a body phrase and a keyword value:

body:error and tag:api

Use parentheses to combine alternatives before another predicate:

(a:1 or b:2) and c:3

The field names a, b, c, and tag in the syntax examples must exist in your index before the query can run. Use field completion to replace them with mapped fields.

The query language controls the user-query portion of log search. Osuite applies these constraints outside the compiled query, so query syntax cannot override them:

  • The selected time range.
  • The selected environment. Selecting an empty environment restricts results to logs without resource.service.environment.
  • Service restrictions from your workspace permissions.

Advanced mode replaces the simple free-text query and filter list. The server rejects a request that supplies an advanced query together with simple q or filters values.

LimitValue
Query length4,096 characters, including whitespace.
Parenthesis nesting10 grouping levels are allowed; 11 are rejected.
Compiled expression depth10 AST levels including the leaf. Nine nested not operators around a leaf are allowed; 10 are rejected.
Leaf expressions50 predicates, ranges, existence checks, or bare words.
WildcardsOne trailing * on string values only.
Search execution10 seconds. Osuite applies both the OpenSearch query timeout and cancellation interval per query.

Regex, fuzzy matching, boosts, aggregations, and pipeline syntax are not part of the advanced query language.

QueryError
timeout errorMissing explicit and or or.
level:ERROR and (service:webMissing closing parenthesis at column 26.
level:Missing value after the operator at column 6.
body:*timeout*Leading wildcard at column 7; use body:timeout.
body:"bad\q"Unsupported quoted escape. Only \" and \\ are accepted.
body>errorRanges are not allowed on a text field.
count=nopeInvalid integer when count is mapped as an integer field.
resoruce.service.name:cartUnknown field; Osuite suggests resource.service.name when it is mapped.

Syntax, type, and field errors appear below the editor. The editor marks the server-reported position so you can correct the failing part of the query.