gpt4 book ai didi

amazon-cloudwatch - 按字段分组的 Cloudwatch 见解查询

转载 作者:行者123 更新时间:2023-12-02 19:52:17 26 4
gpt4 key购买 nike

尝试编写一个 Cloud Watch Insights 查询来连接相同时间戳的错误消息,以便在结果中显示为一行而不是多行。

到目前为止,我已经尝试了以下查询。

fields @timestamp,concat(@message)
| filter @message like /(?i)(Exception|error|fail|)/
| limit 20

这显示结果如下。

2019-09-12T12:17:09.803+10:00 12:17:09,720 |-ERROR in A
2019-09-12T12:17:09.803+10:00 12:17:09,720 |-ERROR in B
2019-09-12T12:17:09.803+10:00 12:17:09,720 |-ERROR in C

我期待以下结果。

2019-09-12T12:17:09.803+10:00 12:17:09,720 |- A 错误 - B 错误 - C 错误

最佳答案

concat 运算符不是聚合函数,因此不会执行您要查找的操作。

相反,它用于在一行中连接多个值,例如

fields @timestamp, concat("Got message ", @message, " from stream ", @logStream)

给你

| 2019-09-12T12:17:09.803+10:00 12:17:09,720 | Got message bla from stream some_log_stream | 

据我所知,无法将多行中的字符串聚合到一行中。

关于amazon-cloudwatch - 按字段分组的 Cloudwatch 见解查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57918037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com