设置我在 Log Insights 中查看 AWS Cloudwatch 时间戳的方式
有没有办法以更友好的格式显示 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试在时间戳字段上使用格式,就像这篇文章中那样。
CloudWatch Insights 查询:格式化日期时间字符串以进行分组
You could try using formatting on the timestamp field like in this post.
CloudWatch Insights query: Format a DateTime string for grouping
虽然使用 datefloor(@timestamp, 1s) 对可读性有很大帮助,但不幸的是官方答案是:
摘自此处找到的文档:
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:
Taken from the documentation found here:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html