The parse-where operator lets you extract values from a string expression based on a pattern and at the same time filter out rows that don’t match the pattern. This operator is useful when you want to ensure that your results contain only rows where the parsing succeeds, reducing the need for an additional filtering step. You can use parse-where when working with logs or event data that follow a known structure but may contain noise or irrelevant lines. For example, you can parse request logs to extract structured information like HTTP method, status code, or error messages, and automatically discard any rows that don’t match the format.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.

Usage

Syntax

parse-where [kind=kind [flags=regexFlags]] expression with [*] stringConstant columnName [:columnType] [*]

Parameters

ParameterDescription
kind(Optional) Specifies the parsing method. The default is simple. You can also specify regex for regular expression parsing.
flags(Optional) Regex flags to control the behavior of pattern matching. Used only with kind=regex.
expressionThe string expression to parse.
stringConstantThe constant parts of the pattern that must match exactly.
columnNameThe name of the column where the extracted value is stored.
columnType(Optional) The type of the extracted value (for example, string, int, real).

Returns

The operator returns a table with the original columns and the newly extracted columns. Rows that do not match the parsing pattern are removed.

Use case example

You want to extract the HTTP method and status code from request logs while ignoring rows that don’t follow the expected format. Query
['http-logs']
| parse-where uri with '/' method:string '/' * 'status=' status:string
| project _time, method, status, uri
Output
_timemethodstatusuri
2025-09-01T12:00:00ZGET200/GET/api/items?status=200
2025-09-01T12:00:05ZPOST500/POST/api/orders?status=500
This query extracts the method and status from the uri field and discards rows where the uri does not match the pattern.
  • extend: Adds calculated columns. Use when parsing is not required but you want to create new derived columns.
  • parse: Extracts values from a string expression without filtering out non-matching rows. Use when you want to keep all rows, including those that fail to parse.
  • project: Selects and computes columns without parsing. Use when you want to transform data rather than extract values.
  • where: Filters rows based on conditions. Use alongside parsing functions if you want more control over filtering logic.