Skip to content

What is the optimal way to send ECS task log to two different locations?

0

I want to send ECS tasks logs to both Cloudwatch Logs and external endpoint (New Relic for instance). I'm able to configure sidecar fluentbit container and use awsfirelens driver. But as far as I understand, it requests custom Fluentbit config, which I need to maintenance in addition to the ECS task definition. Is there more elegant way to configure ECS task to send logs to Cloudwatch logs plus another endpoint?

[Why? My current configuration is

ECS task -> Cloudwatch Logs -> Lambda triggered by cloudwatch log -> NewRelic

But I want to run PoC with Cloudwatch Infrequent Access Logs, which doesn't support triggers. So I need another method for shipping logs to both Cloudwatch and NewRelic]

asked a year ago468 views

2 Answers
1

Hello.

Unfortunately, you cannot specify multiple log drivers simultaneously in a single ECS task definition.
So your options are either using Lambda, which you've already tried, or using FireLens to forward logs in a sidecar container.

Another option is to use Data Firehose to forward logs from CloudWatch Logs to New Relic.
This way, you don't need to create a sidecar container or Lambda, so I think you can create a relatively simple configuration.
https://docs.newrelic.com/docs/logs/forward-logs/stream-logs-using-kinesis-data-firehose/

However, please note that if you use the Data Firehose method, you cannot use the Infrequent Access class.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html

EXPERT

answered a year ago

  • Thank you, @Riku_Kobayashi.

    As I wrote, I want to migrate to Cloudwatch IA logs tier, so Kinesis Data Firehose doesn't support that.

  • In that case, unfortunately, the only way to do this is to configure FireLens on ECS and send logs from the sidecar container to CloudWatch Logs and Newrelic.

0

Hi,

FireLens is the recommended solution to send ECS logs to multiple destintations including partner services.

See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html for all details

Didier

EXPERT

answered a year ago

  • "I'm able to configure sidecar fluentbit container and use aws firelens driver. But as far as I understand, it requests custom Fluentbit config, which I need to maintenance in addition to the ECS task definition. Is there more elegant way to configure ECS task to send logs to Cloudwatch logs plus another endpoint?"

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.