设置我在 Log Insights 中查看 AWS Cloudwatch 时间戳的方式

发布于 2025-01-14 19:08:54 字数 285 浏览 6 评论 0原文

有没有办法以更友好的格式显示 CloudWatch 中的时间戳? 如果我们进行一个超级简单的查询:

fields @timestamp, @message
| sort @timestamp desc
| limit 200

我得到标准的@timestamp列来显示:

2022-03-15T13:38:15.567+00:00

我可以有一些简单的东西,例如:

13:38:15

Is there a way to show the timestamps in cloudwatch in a friendlier format?
If we take a super simple query:

fields @timestamp, @message
| sort @timestamp desc
| limit 200

I get the standard @timestamp column to show:

2022-03-15T13:38:15.567+00:00

Can I have something simple like:

13:38:15

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

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

发布评论

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

评论(2

嘴硬脾气大 2025-01-21 19:08:54

您可以尝试在时间戳字段上使用格式,就像这篇文章中那样。

CloudWatch Insights 查询:格式化日期时间字符串以进行分组

You could try using formatting on the timestamp field like in this post.

CloudWatch Insights query: Format a DateTime string for grouping

梦回旧景 2025-01-21 19:08:54

虽然使用 datefloor(@timestamp, 1s) 对可读性有很大帮助,但不幸的是官方答案是:

目前,CloudWatch Logs Insights 不支持过滤具有人类可读时间戳的日志。

摘自此处找到的文档:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/日志/CWL_QuerySyntax.html

Although using datefloor(@timestamp, 1s) helps a lot with readability, unfortunately the official answer is:

Currently, CloudWatch Logs Insights doesn't support filtering logs with human readable timestamps.

Taken from the documentation found here:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html

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