avg
The avg function returns the average of values within a numeric column. It
ignores NULL values during the calculation. It is often used
with match to calculate the averages within specific groups in the data.
| Syntax | Param data types | Return type |
|---|---|---|
avg(numericExpression) |
NUMBER |
NUMBER |
Code Sample
Find all the events where
target.ipis not empty. For all the events that match onprincipal.ip, store the average ofmetadata.event_timestamp.secondsin a variable calledavg_seconds.target.ip != "" match: principal.ip outcome: $avg_seconds = avg(metadata.event_timestamp.seconds)