如何仅在CloudWatch输出中显示唯一的行?

发布于 2025-01-30 10:29:48 字数 421 浏览 5 评论 0原文

我有一个CloudWatch查询,该查询创建了一个看起来像类似的输出表:

id    | name   | age
1313  | Sam    | 24 
1313  | Sam    | 24 
1313  | Sam    | 24 
1481  | David  | 62
1481  | David  | 62
3748  | Sarah  | 37
3748  | Sarah  | 37
3748  | Sarah  | 37
1481  | David  | 62

是否有一种使CloudWatch自动重复其输出的方法,因此我只看到:

id    | name   | age
1313  | Sam    | 24 
1481  | David  | 62
3748  | Sarah  | 37

I have a CloudWatch query that creates a table of output that looks something like:

id    | name   | age
1313  | Sam    | 24 
1313  | Sam    | 24 
1313  | Sam    | 24 
1481  | David  | 62
1481  | David  | 62
3748  | Sarah  | 37
3748  | Sarah  | 37
3748  | Sarah  | 37
1481  | David  | 62

Is there a way to have CloudWatch automatically deduplicate its output, so I just see:

id    | name   | age
1313  | Sam    | 24 
1481  | David  | 62
3748  | Sarah  | 37

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

八巷 2025-02-06 10:29:48

您可以在这三个字段上计算一个汇总值,然后将其放置(仅保留这3个)。例如:

YOUR CURRENT QUERY | count(*) by id, name, age | display id, name, age

You can calculate an aggregated value across these 3 fields and then drop it (keep just these 3). Like this for example:

YOUR CURRENT QUERY | count(*) by id, name, age | display id, name, age
时光清浅 2025-02-06 10:29:48

我假设 dedupe 两年前不存在2年前,但是现在您可以这样做:

fields id, name, age
| dedup id

给定的文档示例

fields @timestamp, server, severity, message 
| sort @timestamp desc 
| dedup server

I assume dedupe didn't exist 2 years ago, but now you can do this:

fields id, name, age
| dedup id

Given documentation example

fields @timestamp, server, severity, message 
| sort @timestamp desc 
| dedup server
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文