Available: math:rangeOutliers()
v1.268.0
The math:rangeOutliers() function is
available from version 1.268.0.
The math:rangeOutliers() function is a
filter function that keeps events with a numeric value outside a
closed range. The closed range
[low,
high]
includes both bounds.
The math:rangeOutliers() function returns
the opposite result of a range check, such as value >=
0 and value <= 10. However, one important difference
applies. If the value or either bound is missing or non-numeric,
the function drops the event.
Typical use cases include the following tasks:
Find readings outside fixed tolerance limits, such as temperature, latency, or payload size.
Find events outside a per-event expected range. Other fields, such as expectedMin and expectedMax, can define or calculate this range.
Exclude outliers from further analysis with the negated function:
!math:rangeOutliers(...).
For example:
math:rangeOutliers(field=responseTime, low=0, high=500)| Signature | math:rangeOutliers(field, high, low) |
math:rangeOutliers()| Parameter | Type | Interpreted Type | Required | Default Value | Description |
|---|---|---|---|---|---|
field[a] | Â | expression | required | Â | The value to test. An event is an outlier if this value is less than low or greater than high. Any expression is allowed. If the result is non-numeric, the event is undecided. |
high | Â | expression | required | Â | The inclusive upper bound. If the value is greater than this bound, the event is an outlier. Any expression is allowed. If the result is non-numeric, the event is undecided. |
low | Â | expression | required | Â | The inclusive lower bound. If the value is less than this bound, the event is an outlier. Any expression is allowed. If the result is non-numeric, the event is undecided. |
Hide omitted argument names for this function
Omitted Argument NamesThe argument name for
fieldcan be omitted; the following forms of this function are equivalent:logscale Syntaxmath:rangeOutliers("value",high="value",low="value")and:
logscale Syntaxmath:rangeOutliers(field="value",high="value",low="value")These examples show basic structure only.
math:rangeOutliers() Function Operation
The math:rangeOutliers() function has
specific implementation and operational considerations,
outlined below.
The math:rangeOutliers() function
evaluates all three expressions for each event. Each
expression can be any of the following types:
A literal value, such as
10.A field reference, such as responseTime.
An arithmetic expression, such as
low+1.A function call, such as
math:sqrt(value).
You can combine literal arguments and field-based arguments in the same function call.
Behavior
For each event, the function evaluates the
field,
low,
and
high
expressions. Then the function converts each result to an
IEEE 754 double-precision floating-point number.
The function applies the following rules:
Undecided events: If any of the three values is missing, non-numeric, or
NaN, the event is undecided. The function treats undecided events as non-outliers.Outlier events: If all three values are valid numbers, the function compares them. The event is an outlier only if
field < loworfield > high. This condition is equivalent to!(low <= field and field <= high).
A missing bound makes the event undecided. If
low
or
high
is missing, the function drops the event. This rule applies
even if the value is far outside any reasonable range. The
function does not treat a missing bound as unbounded. For a
one-sided check, set the unused bound to a large finite
value, such as high=1e308 or
low=-1e308. Alternatively, write a plain
comparison, such as value > 10.
NaN in any of the three values makes the
event undecided.
Note
The math:rangeOutliers() function
only filters events. It returns each kept event unchanged,
with all fields intact. Kept events retain their original
order. math:rangeOutliers() adds no
fields and modifies no fields.
Negation
The negation operator (!) reverses the filter
result. The following table summarizes the results of each
form.
| Condition |
math:rangeOutliers()
|
!math:rangeOutliers()
|
|---|---|---|
field < low or field > high
| Kept | Dropped |
low <= field and field <= high
| Dropped | Kept |
field, low, or high is missing
| Dropped | Kept |
field, low, or high is non-numeric
| Dropped | Kept |
field, low, or high evaluates to NaN
| Dropped | Kept |
Negation keeps undecided events. The negated
math:rangeOutliers() function also
returns events with missing, non-numeric, or
NaN values. This behavior might be
unexpected. To return only valid numbers inside the range,
write a plain numeric comparison instead.
Boundary Values
The range is closed. If field == low or
field == high, the value is inside the range.
These values are not outliers.
math:rangeOutliers() applies no
tolerance. For example, with low=0 and
high=10, the function evaluates values as
follows:
10.0000001is an outlier.9.9999is not an outlier.
math:rangeOutliers() compares
double-precision values. Integers greater than
253 can lose precision before the
comparison.
A low value can be greater than the high value. The
math:rangeOutliers() function performs
no bound validation. In this case, no number can be inside
the range. As a result, every event with three valid numeric
values is an outlier.
A low value can equal the high value. In this case, the range is a single point. Every value except that point is an outlier.
If
field
is +Infinity, the event is an outlier
unless
high
is also +Infinity. If
field
is -Infinity, the event is an outlier
unless
low
is also -Infinity.
math:rangeOutliers() Syntax Examples
Note
In the following input and result listings, an empty CSV value represents a missing field.
This example finds events with a value outside the range
0 to 10.
Use fixed limits to find readings outside fixed tolerance
limits, such as temperature, latency, or payload size. The
boundary values 0 and 10
are inside the range.
math:rangeOutliers(field=value, low=0, high=10)If event data looks like this:
| value |
|---|
| 5 |
| 0 |
| 10 |
| -1 |
| 11 |
| 10.0001 |
| -0.0001 |
it would return:
| value |
|---|
| -1 |
| 11 |
| 10.0001 |
| -0.0001 |
This example uses per-event limits from fields.
Use per-event limits to find events outside a per-event expected range. In this example, the low and high fields of each event define the range boundaries.
math:rangeOutliers(field=value, low=low, high=high)If event data looks like this:
| value | low | high |
|---|---|---|
| 5 | 0 | 10 |
| 15 | 0 | 10 |
| 5 | 6 | 10 |
it would return:
| value | low | high |
|---|---|---|
| 15 | 0 | 10 |
| 5 | 6 | 10 |
This example uses calculated expressions for all three arguments.
All three arguments can be expressions. In this example, the
query doubles the value. The query also narrows the range by
1 on each side.
math:rangeOutliers(field=value*2, low=low+1, high=high-1)If event data looks like this:
| value | low | high |
|---|---|---|
| 5 | 0 | 20 |
| 15 | 0 | 20 |
| 4 | 5 | 20 |
| 5 | 0 | 5 |
The following table shows the effective values and ranges for each event.
| Effective Value | Effective Range | Result |
|---|---|---|
10
|
[1, 19]
| Inside range (dropped) |
30
|
[1, 19]
| Outlier (kept) |
8
|
[6, 19]
| Inside range (dropped) |
10
|
[1, 4]
| Outlier (kept) |
it would return:
| value | low | high |
|---|---|---|
| 15 | 0 | 20 |
| 5 | 0 | 5 |
This example shows that missing values make events undecided.
The non-negated math:rangeOutliers()
function drops events with a missing
value, low, or
high field.
math:rangeOutliers(field=value, low=low, high=high)If event data looks like this:
| value | low | high |
|---|---|---|
| 5 | 0 | 10 |
| <no value> | 0 | 10 |
| 5 | <no value> | 10 |
| 5 | 0 | <no value> |
| 15 | 0 | 10 |
it would return:
| value | low | high |
|---|---|---|
| 15 | 0 | 10 |
This example shows that negation keeps missing and non-numeric events.
Use the negated math:rangeOutliers()
function to exclude outliers from further analysis. This
example applies the negated function to input similar to the
previous example. The input also contains one non-numeric
value.
!math:rangeOutliers(field=value, low=low, high=high)If event data looks like this:
| value | low | high |
|---|---|---|
| 5 | 0 | 10 |
| <no value> | 0 | 10 |
| 5 | <no value> | 10 |
| notanumber | 0 | 10 |
| 15 | 0 | 10 |
it would return:
| value | low | high |
|---|---|---|
| 5 | 0 | 10 |
| <no value> | 0 | 10 |
| 5 | <no value> | 10 |
| notanumber | 0 | 10 |
The negated math:rangeOutliers() function
removes only the confirmed outlier, 15.
This example shows how the function handles division results,
NaN, and infinity.
This example tests a ratio that must fall between
0 and 1. Division by
zero produces infinity, which is an outlier. The expression
0/0 produces NaN, which makes
the event undecided.
math:rangeOutliers(field=numerator / divisor, low=0, high=1)If event data looks like this:
| numerator | divisor |
|---|---|
| 5 | 10 |
| 15 | 10 |
| 4 | -1 |
| 1 | 0 |
| 0 | 0 |
| 10 | 10 |
it would return:
| numerator | divisor |
|---|---|
| 15 | 10 |
| 4 | -1 |
| 1 | 0 |
The math:rangeOutliers() function
evaluates each ratio as follows:
5/10=0.5. This value is inside the range, so the function drops the event.15/10=1.5. This value is an outlier, so the function keeps the event.4/-1=-4. This value is an outlier, so the function keeps the event.1/0= infinity. This value is an outlier, so the function keeps the event.0/0=NaN. The event is undecided, so the function drops the event.10/10=1. This value equals the upper bound, so the function drops the event.
This example uses a constant value.
The
field
argument can be a constant. In this example, the bounds come
from each event.
math:rangeOutliers(field=5, low=low, high=high)If event data looks like this:
| low | high |
|---|---|
| 0 | 10 |
| 6 | 10 |
| 0 | 4 |
| 5 | 10 |
| 0 | 5 |
it would return:
| low | high |
|---|---|
| 6 | 10 |
| 0 | 4 |
math:rangeOutliers() Examples
Click next to an example below to get the full details.
Find API Response Times Outside Fixed Limits
Filter events with response times outside a closed range of fixed
limits using the math:rangeOutliers()
function
Query
math:rangeOutliers(field=responseTime, low=0, high=500)Introduction
In this example, the math:rangeOutliers() function
is used to find API requests with response times outside the expected
range of 0 to 500 milliseconds.
Response times above the upper bound indicate slow requests that breach
a service level objective, and negative response times indicate clock
skew or instrumentation errors.
Example incoming data might look like this:
| @timestamp | service | endpoint | status | responseTime |
|---|---|---|---|---|
| 2026-03-15T08:00:00Z | checkout-api | /api/v1/cart | 200 | 142 |
| 2026-03-15T08:01:00Z | auth-api | /api/v1/login | 200 | 0 |
| 2026-03-15T08:02:00Z | checkout-api | /api/v1/payment | 200 | -12 |
| 2026-03-15T08:03:00Z | search-api | /api/v1/search | 200 | 500 |
| 2026-03-15T08:04:00Z | checkout-api | /api/v1/payment | 200 | 1830 |
| 2026-03-15T08:05:00Z | auth-api | /api/v1/token | 200 | 87 |
| 2026-03-15T08:06:00Z | search-api | /api/v1/search | 200 | 500.1 |
| 2026-03-15T08:07:00Z | checkout-api | /api/v1/cart | 200 | 231 |
| 2026-03-15T08:08:00Z | checkout-api | /api/v1/payment | 504 | 2405 |
| 2026-03-15T08:09:00Z | auth-api | /api/v1/login | 200 | 312 |
| 2026-03-15T08:10:00Z | search-api | /api/v1/suggest | 200 | -0.5 |
| 2026-03-15T08:11:00Z | auth-api | /api/v1/token | 200 | 499.9999 |
| 2026-03-15T08:12:00Z | checkout-api | /api/v1/cart | 200 | <no value> |
| 2026-03-15T08:13:00Z | checkout-api | /api/v1/payment | 200 | 750 |
| 2026-03-15T08:14:00Z | search-api | /api/v1/search | 502 | - |
| 2026-03-15T08:15:00Z | auth-api | /api/v1/login | 200 | 64 |
In the input listing, an empty value represents a missing responseTime field.
Step-by-Step
Starting with the source repository events.
- logscale
math:rangeOutliers(field=responseTime, low=0, high=500)Filters the events by checking the value of the responseTime field against the closed range from
0to500, and keeps only the events where the value falls outside that range.The
lowparameter sets the inclusive lower bound to0.The
highparameter sets the inclusive upper bound to500.All three parameters are required and have no default values. For a one-sided check, set the unused bound to a large finite value, for example
low=-1e308, because a missing bound is not treated as unbounded.For each event, the
math:rangeOutliers()function converts the three values to double-precision floating-point numbers and compares them. An event is an outlier, and is kept, only if the responseTime value is less than0or greater than500. Values equal to0or500are inside the range, and the function applies no tolerance margin.If the responseTime field is missing, non-numeric, or
NaN, the event is undecided.math:rangeOutliers()treats undecided events as non-outliers and drops them.The function returns the kept events unchanged and in their original order. It does not add an output field.
Event Result set.
Summary and Results
The query is used to identify API requests with response times outside a
fixed expected range, in this case response times below
0 or above 500 milliseconds.
This query is useful, for example, to detect requests that breach a latency service level objective, find slow endpoints, or spot negative response times caused by clock skew or faulty instrumentation. The same approach applies to other measurements with fixed limits, such as payload size or hardware temperature.
Sample output from the incoming example data:
| service | endpoint | status | responseTime |
|---|---|---|---|
| checkout-api | /api/v1/payment | 200 | -12 |
| checkout-api | /api/v1/payment | 200 | 1830 |
| search-api | /api/v1/search | 200 | 500.1 |
| checkout-api | /api/v1/payment | 504 | 2405 |
| search-api | /api/v1/suggest | 200 | -0.5 |
| checkout-api | /api/v1/payment | 200 | 750 |
Note that the closed range includes both bounds and applies no tolerance
margin. The response times of exactly 0 and exactly
500, and the value 499.9999, are
therefore not returned, while values just outside the limits, such as
500.1 and -0.5, are returned as
outliers. The event with a missing responseTime
field and the event with the value -, which many
access logs use as a placeholder for an unknown value, are also dropped,
because the function treats undecided events as non-outliers. Requests
without a valid response time therefore need a separate check.
The /api/v1/payment endpoint of the
checkout-api service appears four times in the
results, three times as a slow request and once with a negative response
time, which might indicate both a performance problem and a timing issue
in that service.
Find Temperature Readings Outside Fixed Tolerance Limits
Filter events with numeric values outside a closed range of fixed
limits using the math:rangeOutliers()
function
Query
math:rangeOutliers(field=temperature, low=0, high=10)Introduction
In this example, the math:rangeOutliers() function
is used to find temperature readings from refrigeration units in a cold
storage facility that fall outside the allowed range of
0 to 10 degrees Celsius.
Example incoming data might look like this:
| @timestamp | sensor_id | location | temperature |
|---|---|---|---|
| 2026-03-15T08:00:00Z | fridge-01 | warehouse-a | 4.2 |
| 2026-03-15T08:05:00Z | fridge-02 | warehouse-a | 0 |
| 2026-03-15T08:10:00Z | fridge-03 | warehouse-b | -1.5 |
| 2026-03-15T08:15:00Z | fridge-01 | warehouse-a | 10 |
| 2026-03-15T08:20:00Z | fridge-04 | warehouse-b | 12.8 |
| 2026-03-15T08:25:00Z | fridge-02 | warehouse-a | 6.7 |
| 2026-03-15T08:30:00Z | fridge-05 | warehouse-c | 10.1 |
| 2026-03-15T08:35:00Z | fridge-03 | warehouse-b | 3.9 |
| 2026-03-15T08:40:00Z | fridge-04 | warehouse-b | 15.3 |
| 2026-03-15T08:45:00Z | fridge-05 | warehouse-c | 8.4 |
| 2026-03-15T08:50:00Z | fridge-01 | warehouse-a | -0.2 |
| 2026-03-15T08:55:00Z | fridge-02 | warehouse-a | 9.9999 |
| 2026-03-15T09:00:00Z | fridge-03 | warehouse-b | <no value> |
| 2026-03-15T09:05:00Z | fridge-04 | warehouse-b | 11 |
| 2026-03-15T09:10:00Z | fridge-05 | warehouse-c | ERR |
| 2026-03-15T09:15:00Z | fridge-01 | warehouse-a | 2.3 |
In the input listing, an empty value represents a missing temperature field.
Step-by-Step
Starting with the source repository events.
- logscale
math:rangeOutliers(field=temperature, low=0, high=10)Filters the events by checking the value of the temperature field against the closed range from
0to10, and keeps only the events where the value falls outside that range.The
fieldparameter specifies the value to test, in this example the temperature field. This is the unnamed parameter, so the query can also be written asmath:rangeOutliers(temperature, low=0, high=10).The
lowparameter sets the inclusive lower bound to0.The
highparameter sets the inclusive upper bound to10.All three parameters are required and have no default values. For a one-sided check, set the unused bound to a large finite value, for example
high=1e308, because a missing bound is not treated as unbounded.For each event, the function converts the three values to double-precision floating-point numbers and compares them. An event is an outlier, and is kept, only if the temperature value is less than
0or greater than10. Values equal to0or10are inside the range, and the function applies no tolerance margin.If the temperature field is missing, non-numeric, or
NaN, the event is undecided. The function treats undecided events as non-outliers and drops them.The function returns the kept events unchanged and in their original order. It does not add an output field.
Event Result set.
Summary and Results
The query is used to identify sensor readings that fall outside a fixed
tolerance range, in this case refrigeration temperatures below
0 or above 10 degrees Celsius.
This query is useful, for example, to monitor cold chain compliance, detect failing refrigeration units, or trigger alerts when goods are at risk of freezing or spoiling. The same approach applies to other measurements with fixed limits, such as response latency or payload size.
Sample output from the incoming example data:
| sensor_id | location | temperature |
|---|---|---|
| fridge-03 | warehouse-b | -1.5 |
| fridge-04 | warehouse-b | 12.8 |
| fridge-05 | warehouse-c | 10.1 |
| fridge-04 | warehouse-b | 15.3 |
| fridge-01 | warehouse-a | -0.2 |
| fridge-04 | warehouse-b | 11 |
Note that the closed range includes both bounds and applies no tolerance
margin, so the readings of exactly 0 from
fridge-02 and exactly 10 from
fridge-01 and the value 9.9999 are
not returned, while values just outside the limits, such as
10.1 and -0.2, are returned as
outliers. The event from fridge-03 with a missing
temperature field and the event from
fridge-05 with the non-numeric value
ERR are also dropped, because the function treats
undecided events as non-outliers, so faulty or empty readings need a
separate check. The sensor fridge-04 in
warehouse-b appears three times in the results, which
might indicate a recurring problem with that unit rather than a single
deviation.
For related methods that detect outliers based on a statistical baseline instead of fixed tolerance limits, see ???, which uses a fixed average and standard deviation, and ???, which uses literal quartiles and the interquartile range.