ECS task definitions should have a logging configuration
Confirms that the latest active ECS task definition has a logging configuration with a valid logDriver specified for all container definitions.
- service
- ECS
- severity
- High
- scope
- evaluated in every region
How to fix it
Give every container definition in the family's latest active revision a logConfiguration with a logDriver set. Any driver satisfies this, a third-party log router as much as awslogs. Using awslogs means creating the CloudWatch log group first and granting the task execution role permission to write to it. This needs a new revision, with every service and scheduled task repointed at it.
In the console
ECS → Task definitions → the family → the latest revision → Create new revision with JSON
With Terraform
resource "aws_ecs_task_definition" "this" {
family = "example"
container_definitions = jsonencode([{
name = "app"
image = var.container_image
logConfiguration = {
logDriver = "awslogs"
options = {
"awslogs-group" = aws_cloudwatch_log_group.this.name
"awslogs-region" = var.aws_region
"awslogs-stream-prefix" = "app"
}
}
}])
}
See which of your accounts this check is failing on.
Book a demo