如何在 Cloudwatch Log Insights 中按聚合对结果进行排序?

How can I sort results by aggregate in Cloudwatch Log Insights?

我有一个非常简单的查询:

fields @timestamp, req.url, msg
| sort @timestamp desc
| filter msg = "request completed"
| stats count() by req.url

它显示了由 url 聚合的我的应用服务的所有请求。但是,我还想按聚合值 count() 对结果进行排序 - 但 | sort count desc| sort "count()" desc 都不起作用。我怎样才能做到这一点?

事实证明,我所要做的就是使用别名,然后按它排序:

fields @timestamp, msg, req.url
| filter msg="request completed"
| stats count() as count by req.url
| sort count desc