Cloudwatch - 如何使用百分位数?

Cloudwatch - how to use percentile?

我认为 Cloudwatch 支持百分位数,但如果我尝试将其添加到我的查询中:

| stats precentile(someValue, 90)

为了获取 someValue 的 p90,它抱怨说 precentile 不是一个可识别的选项.. Cloudwatch 不支持百分位数吗?

我想你在找 pct:

pct(fieldName: LogFieldValue, percent: number)

A percentile indicates the relative standing of a value in a dataset. For example, pct(@duration, 95) returns the @duration value at which 95 percent of the values of @duration are lower than this value, and 5 percent are higher than this value.

来源:aws docs

是的,CloudWatch Logs Insights 支持百分位数。语法是:

pct(fieldName: LogFieldValue, percent: number)

例如:

stats pct(@duration, 90)


参考: CloudWatch Logs Insights query syntax