Aggregations

Overview

Aggregations compute metrics from your filtered data. Use them to answer questions like "How many errors per service?".

Syntax

Use the pipe operator | to chain a stats command after your filters:

<filters> | stats <function>(<field>) as <alias>

Single aggregation:

level:error | stats count()

Multiple aggregations:

level:error | stats count() total, count_uniq(workload) services

With grouping:

level:error | stats by (workload) count() errors

Counting Functions

count()

Count the number of records.

level:error | stats count()

count_empty(field)

Count records where a field is empty.

Logs with no error field

count_uniq(field)

Count unique values in a field.

Number of unique users

Numeric Aggregations

Numeric functions attempt to convert field values to numbers. Non-numeric values are treated as NULL and ignored.

avg(field)

Calculate the average (mean) value.

sum(field)

Calculate the total sum.

min(field) and max(field)

Find minimum and maximum values.

median(field)

Calculate the median value (50th percentile).

quantile(p, field)

Calculate percentiles. Use values between 0 and 1 (0.5 = 50th percentile, 0.95 = 95th percentile).

sum_len(field)

Sum the length of string values.

Total characters in all messages

Value Aggregations

values(field)

Get all values (with duplicates).

All error messages

uniq_values(field)

Get unique values (no duplicates).

List of all status codes seen

Grouping with 'by'

Group results by one or more fields.

Single Field Grouping

Multiple Field Grouping

Multiple Functions

Post-Aggregation Filtering

Filter results after aggregation.

Using filter pipe

Workloads with more than 1000 requests

Implicit Filtering (Without filter keyword)

Same as above, shorter syntax

Time-Series Aggregations

Note: In groundcover, time bucketing is configured externally through the UI time range selector, not in the query itself.

Count logs per workload (time interval set in UI)

Requests per status code over time

Last updated