ECS AWS Cloudwatch日志 [英] ECS AWS Cloudwatch logs

查看:262
本文介绍了ECS AWS Cloudwatch日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ECS中有一个运行tomcat的任务。该tomcat部署了2或3个应用程序。我知道这不是理想的情况,但这就是我们所拥有的。使用Log4j,应用程序的日志转到tomcat的logs文件夹下的其他日志文件。有什么方法可以让我的docker容器中的那些不同的日志文件到CloudWatch下的流不同?我知道,如果我使用log4j附加程序将日志写入stdout,则可以轻松地将它们存储在cloudwatch中,但是它们不会分开,它将成为所有应用程序的日志记录。

I have a task in ECS that runs tomcat. That tomcat has 2 or 3 apps deployed to it. I know its not an ideal situation but this is what we've got. Log4j is used and logs for apps goto different log files under logs folder of tomcat. Is there a way I can have those different log files from my docker container to CloudWatch under different streams? I know if I write logs to stdout using log4j appender I can have them in cloudwatch easily but then they will not be separate, it'll be log from all apps going in one place.

非常感谢

推荐答案

您可以设置日志配置和docker日志,而不是使用log4j并将日志发送到STDOUT aws-logs的驱动程序,它将帮助您使用cloudwatch代理将日志直接发送到cloudwatch。

Instead of using log4j and sending logs to STDOUT you may set your log-configuration and docker log driver to aws-logs, which will help you to send logs directly to the cloudwatch using cloudwatch agent.

参考: https://aws.amazon.com/blogs/devops/send -ecs容器日志到cloudwatch日志以进行集中监视/

这篇关于ECS AWS Cloudwatch日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆