Browse docs
On this page

where command

Filter the output of an aggregation, or narrow raw events further.

All ObiQL commands

Keeps only the rows that match a condition. After stats or timechart it filters the aggregate rows, such as groups whose count passed a threshold. On raw events it narrows the results further, and is how you filter fields that json, extract or eval created.

The condition uses the same syntax as the search itself: field comparisons, wildcards, ranges, AND, OR, NOT and parentheses.

Syntax

ObiQL
| where <condition>

Square brackets mark an optional part, and angle brackets a value you supply.

Arguments

ArgumentRequiredDescription
<condition>RequiredOne or more comparisons such as field=value, field!=value, field>number or field=[low TO high]. Adjacent comparisons are joined with AND. Use OR, NOT or - and parentheses to combine them differently.

Usage

  • A search filter in front of the first | filters stored events, and is usually faster. Use where for anything that only exists after a stage: aggregate columns and fields made by json, extract or eval.
  • Comparisons with >, <, >= and <= need a number.
  • Columns added by lookup cannot be filtered with where.

Examples

1. Slow requests

ObiQL
service=checkout-api | where duration_ms > 500

Keeps events whose duration is over 500 milliseconds.

2. Services above an error count

ObiQL
level="error" | stats count() by service | where count > 100

Filters the aggregate rows, not the events.

3. Filter on a field read out of JSON

ObiQL
| json field=message | where country=SE AND status>=500

Fields that json creates can be filtered after it.

4. Rows where a field is set

ObiQL
| inputlookup hostname_map | where owner_team=*

field=* matches rows with a non-empty value for the field.