Prerequisites
- AWS CLI configured
- Access to:
- AWS ECR
- AWS ECS (Fargate)
- AWS CloudWatch
- AWS VPC
- AWS ECR
Overview
This setup sends logs to both Atatus and CloudWatch Logs using a Atatus Fluent Bit image with dual outputs.
Step 1: Create ECS Task Definition
Replace the following placeholders with your actual values: <YOUR_REGION>
, <YOUR_CLOUDWATCH_LOG_GROUP_NAME>
, <LOG_STREAM_PREFIX>
, <YOUR_CONTAINER_NAME>
, <YOUR_APP_IMAGE>
, <YOUR_ATATUS_LOGS_INGEST_LICENSE_KEY>
, <YOUR_SERVICE_NAME>
, <YOUR_TASK_EXECUTION_ROLE>
copy
{
"family": "atatus-aws-ecs-fargate-fluent-bit",
"containerDefinitions": [
{
"name": "log_router",
"image": "atatus/aws-ecs-fargate-fluent-bit:1.0.0",
"cpu": 0,
"memoryReservation": 50,
"portMappings": [],
"essential": true,
"environment": [
{ "name": "AWS_REGION", "value": "<YOUR_REGION>" },
{ "name": "LOG_GROUP_NAME", "value": "<YOUR_CLOUDWATCH_LOG_GROUP_NAME>" },
{ "name": "LOG_STREAM_PREFIX", "value": "ecs" }
],
"mountPoints": [],
"volumesFrom": [],
"user": "0",
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/log-router",
"awslogs-region": "<YOUR_REGION>",
"awslogs-stream-prefix": "firelens"
}
},
"systemControls": [],
"firelensConfiguration": {
"type": "fluentbit",
"options": {
"enable-ecs-log-metadata": "true",
"config-file-type": "file",
"config-file-value": "/cloudwatch_logs.conf"
}
}
},
{
"name": "<YOUR_CONTAINER_NAME>",
"image": "<YOUR_APP_IMAGE>",
"cpu": 0,
"memoryReservation": 100,
"portMappings": [],
"essential": true,
"environment": [],
"mountPoints": [],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awsfirelens",
"options": {
"tls.verify": "off",
"Header": "x-atatus-ecs-awsfirelens <YOUR_ATATUS_LOGS_INGEST_LICENSE_KEY>:<YOUR_SERVICE_NAME>",
"Port": "443",
"Host": "intake-logs.atatus.com",
"tls": "on",
"URI": "/ingest/v1/logs",
"Name": "http",
"Format": "json_lines"
}
},
"systemControls": []
}
],
"taskRoleArn": "<YOUR_TASK_EXECUTION_ROLE>",
"executionRoleArn": "<YOUR_TASK_EXECUTION_ROLE>",
"networkMode": "awsvpc",
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "256",
"memory": "512"
}
Sample Data for Placeholders:
Use the below values as examples when replacing placeholders in your task definition:
<YOUR_REGION>
– us-east-1<YOUR_CLOUDWATCH_LOG_GROUP_NAME>
– app-logs<YOUR_LOG_STREAM_PREFIX>
- ecs<YOUR_CONTAINER_NAME>
– my-app<YOUR_APP_IMAGE>
– 123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest<YOUR_ATATUS_LOGS_INGEST_LICENSE_KEY>
– lic_**********************<YOUR_SERVICE_NAME>
– test-service<YOUR_TASK_EXECUTION_ROLE>
– arn:aws:iam::123456789012:role/ecsTaskExecutionRole
Step 2: Deploy Task in ECS
- Open ECS > Task Definitions in AWS Console
- Register the new task definition using the JSON above.
- Launch a task in a suitable Fargate cluster and subnet.
Verification
- CloudWatch Logs: Navigate to your configured log group and confirm log ingestion.
- Atatus: Go to your Atatus Logs Dashboard and confirm logs are visible.