Skip to main content
Sumo Logic

median

Calculates the median value for a given field.

In order to calculate the median value for a particular field, you can utilize the Percentile (pct) operator with a percentile argument of 50.

Syntax:

  • ...| pct(fieldname [, 50]) [as alias] [by group]

Rules:

  • Creates a field named _fieldname_pct_percentile.

Examples

For example:

* | parse "data=*" as data
  | pct(data, 50) as median

To calculate the median value of a field called "Len:*" as seconds, and then take the median, use the following query:

| parse "Len: *" as seconds
| pct(seconds,50) as median

Which would return results similar to: