AWS cloudwatch 日志 datetime_format 配置将多行合并为一行

发布于 2025-01-16 18:54:18 字数 414 浏览 2 评论 0原文

我使用 aws cloudwatch 收集 aws ecs farget 任务的日志。

配置如下图所示:

任务定义中的日志格式

我得到以下日志,它是有线的。一些带有日期时间的行合并在一个日志中。我认为每个以日期时间开头的日志都应该被视为一个日志。

输入图片此处描述

I use aws cloudwatch to collect aws ecs farget task's logs.

The config is in the following pic:

log format in task definition

And I get the following logs, it is wired. Some lines with datetime is combined in one log. I think every log starts with datetime should be seen as one single log.

enter image description here

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

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

发布评论

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

评论(1

献世佛 2025-01-23 18:54:18

awslogs-datetime-format%L 选项包含不正确的文档。我遇到了同样的问题,然后查看了驱动程序源代码, %L 匹配 \.\d{3} (这里是 源链接)。

这意味着该模式已经与模式开头的文字 . 匹配。您可以像这样更改格式并且它会起作用。

awslogs-datetime-format: '%Y-%m-%d %H:%M:%S%L'

The %L option of awslogs-datetime-format has incorrect documentation. I had the same problem and then looked at the driver source code and %L matches \.\d{3} (here's a source link).

This means the pattern already matches a literal . at the start of the pattern. You may change the format like this and it will work.

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