I have some applications running in ECS cluster built on EC2 instances. I’ve a requirement to send the application logs to Firehose.
Currently I’ve used the firelens sidecar containers to fetch the log and send to firehose endpoint. But this creates a log router container for each task in the cluster. Is this the recommended approach for sending logs to firehose?
I’ve tried to export logs to json file and it exports the logs in /var/lib/docker/containers/<container_runtime_id>/<container_runtime_id>-json.log file in the EC2 instance.
I’ve installed the aws-kinesis-agent and configure the agent.conf files to send the logs to Firehose.
This avoids the creation of logrouter container for each tasks.
But a draw back for this is container runtime id keeps changing when tasks get drained and new task comes up. I need to always fetch the container runtime id when a new task is up and update the agent.conf file.
Can we make custom runtime id? Or is there any other way to tackle this problem?
Or are there any other recommended cost effective way to fetch logs from ECS containers and send to firehose?