Amazon ECS Container Logs
This guide explains how to send Amazon ECS container logs from Fargate workloads to KloudMate using Fluent Bit, FireLens, and the OpenTelemetry output plugin.
In this setup:
- Fluent Bit forwards log records
- FireLens routes container logs to Fluent Bit
- The OpenTelemetry output plugin sends those logs to KloudMate
Prerequisites
Section titled “Prerequisites”- Fluent Bit binaries and packages for your environment
- An ECS cluster running the workloads whose logs you want to ship
Step 1: Create a Fluent Bit Image
Section titled “Step 1: Create a Fluent Bit Image”Create a Dockerfile for Fluent Bit:
Step 2: Configure Fluent Bit Output
Section titled “Step 2: Configure Fluent Bit Output”Step 3: Add Parsers
Section titled “Step 3: Add Parsers”Add a parser file that matches your application logs. For example, the parser below handles common NGINX access logs:
Step 4: Push the Image to ECR
Section titled “Step 4: Push the Image to ECR”Push the custom Fluent Bit image to Amazon Elastic Container Registry (ECR).
Step 5: Update the ECS Task Definition
Section titled “Step 5: Update the ECS Task Definition”The task definition below uses two containers: the application container and a Fluent Bit log router. Make sure the Fluent Bit configuration file is included in the image before deploying the task.