This page explains how to use the avg aggregation function in APL.
avg
aggregation in APL calculates the average value of a numeric field across a set of records. You can use this aggregation when you need to determine the mean value of numerical data, such as request durations, response times, or other performance metrics. It is useful in scenarios such as performance analysis, trend identification, and general statistical analysis.
When to use avg
:
Splunk SPL users
avg
function works similarly, but the syntax differs slightly. Here’s how to write the equivalent query in APL.ANSI SQL users
avg
aggregation is used similarly, but APL has a different syntax for structuring the query.status | avg_req_duration_ms |
---|---|
200 | 350.4 |
404 | 150.2 |
sum
to calculate the total of a numeric field. This is useful when you want the total of values rather than their average.count
function returns the total number of records. It’s useful when you want to count occurrences rather than averaging numerical values.min
function returns the minimum value of a numeric field. Use this when you’re interested in the smallest value in your dataset.max
function returns the maximum value of a numeric field. This is useful for finding the largest value in the data.