简体   繁体   English

将日志从ECS Fargate发送到Elasticsearch的最佳方法

[英]Best approach for sending logs from ECS Fargate into Elasticsearch

We have a setup with multiple containers running NodeJS services(node:11-alpine docker image) deployed in AWS ECS Fargate. 我们的安装程序包含多个容器,这些容器运行在AWS ECS Fargate中部署的NodeJS服务(node:11-alpine docker image)。

We already have a running ElasticSearch instance collecting logs from non-Fargate application. 我们已经有一个正在运行的ElasticSearch实例,该实例从非Fargate应用程序收集日志。 I would like to pass the logs from the Fargate containers into this ElasticSearch instance, but I have a hard time to figure out what is the best approach. 我想将日志从Fargate容器传递到此ElasticSearch实例中,但是我很难找出最好的方法。

1) It seem one way is to stream the logs from Cloudwatch --> Lambda --> ElasticSearch. 1)似乎一种方法是从Cloudwatch-> Lambda-> ElasticSearch流日志。 It seem a bit overkill - isn't there another way to do this? 似乎有点矫kill过正-没有其他方法可以做到这一点吗?

2) I was hoping i could run a Logstash docker instance that could collect the logs from the containers but I am not sure if this is possible when running Fargate? 2)我希望我可以运行一个Logstash docker实例,该实例可以从容器中收集日志,但是我不确定在运行Fargate时是否可行?

3) Should I install something like FileBeat on each container and let that send the logs? 3)我是否应该在每个容器上安装FileBeat之类的东西,然后让其发送日志?

Any help is appreciated. 任何帮助表示赞赏。

1) It seems one way is to stream the logs from Cloudwatch --> Lambda --> ElasticSearch. 1)似乎一种方法是从Cloudwatch-> Lambda-> ElasticSearch流日志。 It seem a bit overkill - isn't there another way to do this? 似乎有点矫kill过正-没有其他方法可以做到这一点吗?

If you're looking for an AWS based managed solution, that is the right way. 如果您正在寻找基于AWS的托管解决方案,那是正确的方法。 You don't really need to write a Lambda function, AWS does it for you and that doesn't seem like overkill as this is more managed and more AWS oriented approach. 您实际上并不需要编写Lambda函数,AWS可以为您完成此功能,而且看起来不算过分,因为这是更易于管理和面向AWS的方法。 Also, what this solution is going to do for is going to be the same as Logstash. 另外,此解决方案将要完成的工作与Logstash相同。

2) I was hoping i could run a Logstash docker instance that could collect the logs from the containers but I am not sure if this is possible when running Fargate? 2)我希望我可以运行一个Logstash docker实例,该实例可以从容器中收集日志,但是我不确定在运行Fargate时是否可行?

Yes, that is possible. 是的,那是可能的。

3) Should I install something like FileBeat on each container and let that send the logs? 3)我是否应该在每个容器上安装FileBeat之类的东西,然后让其发送日志?

You can use FileBeat, Fluentd, FunctionBeat or Logstash as you like. 您可以根据需要使用FileBeat,Fluentd,FunctionBeat或Logstash。

Note: If you're thinking of running your own Logstash container, don't enable CloudWatch logging as well as you're not going to use that either. 注意:如果您正在考虑运行自己的Logstash容器,请不要启用CloudWatch日志记录,也不要使用它。 But I would recommend going for AWS based solution for that. 但是我建议为此选择基于AWS的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM