Skip to main content
Use the max_of function in APL (Axiom Processing Language) to return the maximum value from a list of scalar expressions. You can use it when you need to compute the maximum of a fixed set of values within each row, rather than across rows like with aggregation functions. It’s especially useful when the values you want to compare come from different columns or are dynamically calculated within the same row. Use max_of when you want to:
  • Compare multiple fields in a single event to determine the highest value.
  • Perform element-wise maximum calculations in datasets where values are spread across columns.
  • Evaluate conditional values and select the highest one on a per-row basis.
  • Ensure a minimum value. For example, max_of(value, 0) always returns greater than 0.

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.
Splunk doesn’t provide a direct function equivalent to max_of. However, you can use the eval command with nested if statements or custom logic to emulate similar functionality on a per-event basis.
ANSI SQL doesn’t offer a built-in function like max_of to compute the maximum across expressions in a single row. Instead, you typically use GREATEST, which serves a similar purpose.

Usage

Syntax

Parameters

The function takes a comma-separated list of expressions to compare. All values must be of the same type.

Returns

The function returns the maximum value among the input expressions. The type of the result matches the type of the input expressions. All expressions must be of the same or compatible types.

Use case example

You have two data points for the size of HTTP responses: header size and body size. You want to find the maximum of these two values for each event. Query
Run in Playground Output