本文介绍了组合两个CloudWatch洞察查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Cloudwatch洞察查询,我希望能够同时运行并比较这两个查询的结果。

stats count(*) as requestIdCount by @requestId 
| filter @message like /START RequestId/
| filter requestIdCount > 1
stats count(*) as requestIdCount by @requestId 
| filter @message like /END RequestId/
| filter requestIdCount > 1

如果能够做到这一点就太好了

fields (
    stats count(*) as requestIdCount by @requestId 
    | filter @message like /END RequestId/
    | filter requestIdCount > 1) as EndRequestCount,
       (
    stats count(*) as requestIdCount by @requestId 
    | filter @message like /START RequestId/
    | filter requestIdCount > 1) as StartRequestCount 

但我现在看不到任何方法来进行深入的子查询。是否有方法可以组合这样的查询?

推荐答案

试试:

parse @message 'START RequestId' as @startRequestId
    | parse @message 'END RequestId' as @endRequestId
    | stats count(@startRequestId) as startRequestIdCount , count(@endRequestId) as endRequestIdCount by bin(5m)
    | filter startRequestIdCount > 1
    | filter endRequestIdCount > 1

CloudWatch Logs Insights Query Syntax

这篇关于组合两个CloudWatch洞察查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:59