在 ecs 中使用 Spring-Cloud-docker 通过 Cloud-Watch 处理日志记录的最佳实践

Best practice to handle logging via Cloud-Watch with Spring-Cloud-docker in ecs

我尝试了几天来使用 spring-云应用程序设置我的 docker-容器 运行

到目前为止我最好的结果:我进入了 Cloud-Watch 日志的前 20 行(Spring-Ascii-Art 和 Spring 版本中的品牌),仅此而已。当时 EC2 实例上的 docker 显示与 "docker logs" 相同,但是我的系统上的 docker 像往常一样记录。 然而,我的大部分尝试都没有显示通过 "docker logs" 或 Cloud-Watch 进行记录。但同样,我的应用程序日志记录通过 console-appender 通过 log4j2 运行,与配置的完全一样。

甚至我的本地 docker 也如预期的那样具有 app.jar 日志(Windows7、Docker 工具箱,不幸的是,没有 Linux 可能)。仅在 EC2 实例上,"docker logs".

保持沉默

配置:

你能给我一些我可能错过的提示吗?

为什么只有日志的前 20 行(Spring-Header?)

为什么 appender 不显示想要的结果?我希望它会像 "Graylog" 一样简单...在 log-config 中选择正确的 appender-config 瞧,有日志条目。

您是否有一些教程链接,其中的主题是从 spring-cloud 记录到 Cloud-Watch,并解释了所有必要的部分和步骤?

您是否有一些片段(Pom、任务-json、其他提示)可以帮助我完成这项工作?

换成像 Boxfuse 这样的 "everything ready" 解决方案真的更好吗?

非常感谢!

PS:我知道有ELK-Stack和其他的解决方案,但我真的很想先试试Cloud-Watch。

You can leave these fields of the task-definition, they said. The system will choose an appropriate default, they said. Don't bother, they said.

似乎我应该在 task-definition 中为 CPUs 设置一个值...日志的前几行似乎是唯一的东西,那个0-CPU-Task 能够产生...没有其他错误消息。

我笑哭了...