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:

logscale
math:rangeOutliers(field=responseTime, low=0, high=500)
Function Summary
Signaturemath:rangeOutliers(field, high, low)
Parameters for math:rangeOutliers()
ParameterTypeInterpreted TypeRequiredDefault ValueDescription
field[a] expressionrequired   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 expressionrequired   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 expressionrequired   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.

[a] The parameter name field can be omitted.

Hide omitted argument names for this function

Show omitted argument names for this function

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 < low or field > 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.0000001 is an outlier.

  • 9.9999 is 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.

Fixed limits

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.

logscale
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
Per-event limits from fields

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.

logscale
math:rangeOutliers(field=value, low=low, high=high)

If event data looks like this:

valuelowhigh
5010
15010
5610

it would return:

valuelowhigh
15010
5610
Calculated expressions

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.

logscale
math:rangeOutliers(field=value*2, low=low+1, high=high-1)

If event data looks like this:

valuelowhigh
5020
15020
4520
505

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:

valuelowhigh
15020
505
Missing values make events undecided

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.

logscale
math:rangeOutliers(field=value, low=low, high=high)

If event data looks like this:

valuelowhigh
5010
<no value>010
5<no value>10
50<no value>
15010

it would return:

valuelowhigh
15010
Negation keeps missing and non-numeric events

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.

logscale
!math:rangeOutliers(field=value, low=low, high=high)

If event data looks like this:

valuelowhigh
5010
<no value>010
5<no value>10
notanumber010
15010

it would return:

valuelowhigh
5010
<no value>010
5<no value>10
notanumber010

The negated math:rangeOutliers() function removes only the confirmed outlier, 15.

Division results, NaN, and infinity

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.

logscale
math:rangeOutliers(field=numerator / divisor, low=0, high=1)

If event data looks like this:

numeratordivisor
510
1510
4-1
10
00
1010

it would return:

numeratordivisor
1510
4-1
10

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.

Constant value

This example uses a constant value.

The field argument can be a constant. In this example, the bounds come from each event.

logscale
math:rangeOutliers(field=5, low=low, high=high)

If event data looks like this:

lowhigh
010
610
04
510
05

it would return:

lowhigh
610
04

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
logscale
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:

@timestampserviceendpointstatusresponseTime
2026-03-15T08:00:00Zcheckout-api/api/v1/cart200142
2026-03-15T08:01:00Zauth-api/api/v1/login2000
2026-03-15T08:02:00Zcheckout-api/api/v1/payment200-12
2026-03-15T08:03:00Zsearch-api/api/v1/search200500
2026-03-15T08:04:00Zcheckout-api/api/v1/payment2001830
2026-03-15T08:05:00Zauth-api/api/v1/token20087
2026-03-15T08:06:00Zsearch-api/api/v1/search200500.1
2026-03-15T08:07:00Zcheckout-api/api/v1/cart200231
2026-03-15T08:08:00Zcheckout-api/api/v1/payment5042405
2026-03-15T08:09:00Zauth-api/api/v1/login200312
2026-03-15T08:10:00Zsearch-api/api/v1/suggest200-0.5
2026-03-15T08:11:00Zauth-api/api/v1/token200499.9999
2026-03-15T08:12:00Zcheckout-api/api/v1/cart200<no value>
2026-03-15T08:13:00Zcheckout-api/api/v1/payment200750
2026-03-15T08:14:00Zsearch-api/api/v1/search502-
2026-03-15T08:15:00Zauth-api/api/v1/login20064

In the input listing, an empty value represents a missing responseTime field.

Step-by-Step
  1. Starting with the source repository events.

  2. 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 0 to 500, and keeps only the events where the value falls outside that range.

    The low parameter sets the inclusive lower bound to 0.

    The high parameter sets the inclusive upper bound to 500.

    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 than 0 or greater than 500. Values equal to 0 or 500 are 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.

  3. 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:

serviceendpointstatusresponseTime
checkout-api/api/v1/payment200-12
checkout-api/api/v1/payment2001830
search-api/api/v1/search200500.1
checkout-api/api/v1/payment5042405
search-api/api/v1/suggest200-0.5
checkout-api/api/v1/payment200750

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
logscale
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:

@timestampsensor_idlocationtemperature
2026-03-15T08:00:00Zfridge-01warehouse-a4.2
2026-03-15T08:05:00Zfridge-02warehouse-a0
2026-03-15T08:10:00Zfridge-03warehouse-b-1.5
2026-03-15T08:15:00Zfridge-01warehouse-a10
2026-03-15T08:20:00Zfridge-04warehouse-b12.8
2026-03-15T08:25:00Zfridge-02warehouse-a6.7
2026-03-15T08:30:00Zfridge-05warehouse-c10.1
2026-03-15T08:35:00Zfridge-03warehouse-b3.9
2026-03-15T08:40:00Zfridge-04warehouse-b15.3
2026-03-15T08:45:00Zfridge-05warehouse-c8.4
2026-03-15T08:50:00Zfridge-01warehouse-a-0.2
2026-03-15T08:55:00Zfridge-02warehouse-a9.9999
2026-03-15T09:00:00Zfridge-03warehouse-b<no value>
2026-03-15T09:05:00Zfridge-04warehouse-b11
2026-03-15T09:10:00Zfridge-05warehouse-cERR
2026-03-15T09:15:00Zfridge-01warehouse-a2.3

In the input listing, an empty value represents a missing temperature field.

Step-by-Step
  1. Starting with the source repository events.

  2. 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 0 to 10, and keeps only the events where the value falls outside that range.

    The field parameter specifies the value to test, in this example the temperature field. This is the unnamed parameter, so the query can also be written as math:rangeOutliers(temperature, low=0, high=10).

    The low parameter sets the inclusive lower bound to 0.

    The high parameter sets the inclusive upper bound to 10.

    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 0 or greater than 10. Values equal to 0 or 10 are 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.

  3. 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_idlocationtemperature
fridge-03warehouse-b-1.5
fridge-04warehouse-b12.8
fridge-05warehouse-c10.1
fridge-04warehouse-b15.3
fridge-01warehouse-a-0.2
fridge-04warehouse-b11

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.