amazon-cloudwatch - 在 Amazon Cloudwatch Insights 中,您如何获取统计信息?

标签 amazon-cloudwatch aws-cloudwatch-log-insights

我正在使用 AWS Cloudwatch Insights 并运行如下查询:

fields @message, @timestamp
| filter strcontains(@message, "Something of interest happened")
| stats count() as interestCount by bin(10m) as tenMinuteTime
| stats max(interestCount) by datefloor(tenMinuteTime, 1d)
但是,在最后一行,我收到以下错误:
mismatched input 'stats' expecting {K_PARSE, K_SEARCH, K_FIELDS, K_DISPLAY, K_FILTER, K_SORT, K_ORDER, K_HEAD, K_LIMIT, K_TAIL}
这似乎意味着我无法在 Insights 中进行多层统计查询,因此无法进行统计的统计。有没有解决的办法?

最佳答案

您目前不能使用多个 stat 命令,据我所知,目前没有直接的方法可以解决这个问题。但是,您可以将单个 stat 命令加厚并用逗号分隔,如下所示:

fields @message, @timestamp
| filter strcontains(@message, "Something of interest happened")
| stats count() as @interestCount, 
max(interestCount) as @maxInterest, 
interestCount by bin(10m) as @tenMinuteTime
您在 stats 之后定义字段并使用函数,然后处理这些结果字段。

关于amazon-cloudwatch - 在 Amazon Cloudwatch Insights 中,您如何获取统计信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63960452/

相关文章:

amazon-web-services - AWS 日志洞察 : specify @timestamp field output format/timezone?

java - 在 Controller 建议中获取 Controller 名称和java服务路径

amazon-web-services - 如果一个日志具有特定消息,如何显示日志流中的所有 CloudWatch 日志?

amazon-web-services - 从 cloudwatch 中删除自定义指标和自定义命名空间

amazon-web-services - 具有维度的 Amazon Web Service CloudWatch 自定义指标

apache - ECS 日志记录(awslogs 驱动程序)仅将 apache 服务器启动日志记录到 cloudwatch,没有 error.log 和没有 access.log

javascript - 在同步函数中从 AWS Lambda 发出 AWS CloudWatch 指标

aws-lambda - 云观察洞察 : get logs of errored lambdas

amazon-web-services - 如何配置 AWS cloudWatchAgent 以从 EC2 实例上的文件夹递归收集日志?

amazon-web-services - CloudWatch Events 规则限制