Skip to main content

where

Filter events using a boolean expression. Only events where the expression evaluates to true pass through.

Syntax

| where <expression>

Operators

OperatorDescriptionExample
=, !=Equalitystatus = 200
>, >=, <, <=Comparisonduration_ms > 1000
AND, OR, NOTBooleanstatus >= 500 AND source = "nginx"
IN (...)Set membershiplevel IN ("error", "warn")
LIKEPattern matchuri LIKE "%/api/%"
IS NULL, IS NOT NULLNull checkerror_msg IS NOT NULL

Examples

-- Simple comparison
| where status >= 500

-- Multiple conditions
| where status >= 500 AND duration_ms > 1000

-- OR conditions
| where level = "error" OR level = "warn"

-- IN operator
| where level IN ("error", "warn", "fatal")

-- Pattern matching
| where uri LIKE "%/api/v2/%"

-- Null checks
| where error_message IS NOT NULL

-- Computed expressions
| where duration_ms / 1000 > 5

-- Using eval functions
| where match(uri, "^/api/v[0-9]+/users")
| where len(message) > 500

Notes

  • where evaluates expressions using the bytecode VM (22ns/op for simple predicates).
  • The optimizer pushes where predicates down to the scan level when possible, enabling bloom filter and time range pruning.
  • Use where for programmatic filtering; use search for full-text keyword search.

See Also