如何在Cloudwatch日志洞察中按聚合结果进行排序?

38

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

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都不起作用。我该如何实现?

1个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
65

事实证明,我所要做的就是使用别名进行排序:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,