Filter Expressions
The filter expression language allows for data set filtering using a simplified expression language. The language itself supports boolean logic (and
, or
, ()
) and equivalences (>=
, <=
, !=
, ==
). String values are wrapped in quotes (""
, ''
) and columns values can be accessed using the column name. Regex patterns can be provided as well, and require the pattern to be wrapped in forward slashes (\
).
The filter expression language is used with the filter
command, tag
command, and the globally available --filter
flag.
Advanced features​
null
filtering​
The filter expression can be used to filter based on null
values using the null
keyword. For example:
... || filter "status != null"
Regex patterns​
The filter expression can contain regex patterns wrapped in forward slashes (/
). PCRE flags are supported.
Example excluding rows containing the string https://www.{ANY ALPAHANUMERIC}.com/
in the url
column:
... || filter "url != /https:\/\/www.[A-Za-z0-9]+.com/"
Example including rows containing the string https://www.{ANY ALPAHANUMERIC}.com/
in the url
column:
... || filter "url == /https:\/\/www.[A-Za-z0-9]+.com/"
Wildcards​
For simpler filtering on wildcard values without a full regex pattern, the filter expression can include wildcards (*
) to either include or exclude results based on the chosen comparator (==
or !=
).
Example excluding rows containing the string https://www.example.com/
in the url
column:
... || filter "url != 'https://www.example.com/*'"
Example including rows containing the string https://www.example.com/
in the url
column:
... || filter "url == 'https://www.example.com/*'"
Examples​
Filtering for a specific status code​
... || filter "status.code == 200"
The above filter expression will compare the values contained in the status.code
column to the value 200
.
... || filter 'status.code == "ok"'
The above filter expression will compare the values contained in the status.code
column to the value ok
.
... || filter "status.code == code"
The above filter expression will compare the values contained in the status.code
column to the values contained in another column named code
.
... || filter "status.code == /2[0-9][0-9]/"
The above filter expression will compare the values contained in the status.code
column to the regex pattern 2[0-9][0-9]
.
... || filter "status.code == '2*'"
The above filter expression will compare the values contained in the status.code
column to the value containing a wildcard 2*
(matches on anything, the *
wildcard is equivalent to the regex .*
).
Boolean filters​
... || filter "((status.code == 303) or (status.code < 300)) and response.data == 'ok'"
The above filter expression uses parentheses to group logical boolean operations together. This filter willinclude rows where the response.data
value is ok
and the status.code
is either 303
or less than 300
.