AWS ECS logs and metrics
Updated Nov 22, 2026 · today
With the awslogslog driver, ECS sends each container's output to a CloudWatch Logs group, and publishes task and service metrics under the AWS/ECS namespace. Both reach Epok through the shared setup on AWS: logs and metrics.
On this page: What you getTurn on logsMetricsUseful searchesTroubleshooting
What you get
- Logs:each container's stdout and stderr, from the log group you set in the task definition (for example
/ecs/api). - Metrics: the
AWS/ECSnamespace, which includes CPU and memory utilization and reservation.
Each log event is stored with _msg, _time, a level detected from the line, service (the last part of the log group name), log_group, log_stream, cloud.provider, cloud.account_id and cloud.region.
Turn on logs
- In the task definition, set the log configuration to the
awslogsdriver withawslogs-group(the group name),awslogs-regionandawslogs-stream-prefix. The task execution role needslogs:CreateLogStreamandlogs:PutLogEvents. - Create the group ahead of time so it is not empty:
aws logs create-log-group --log-group-name /ecs/<service>. - Add the group to
EPOK_LOG_GROUPSand run the setup on AWS: logs and metrics.
Metrics
The namespace is AWS/ECS. It is in the default metric stream list, so it arrives with the normal metrics setup.
Useful searches
text
log_group:"/ecs/api" level:error # errors from one service
service:api _msg:"OOMKilled" # a specific crash, any task
level:error _time:1h | stats by (service) count() # which services error the most
service:worker _msg:err* # prefix match on the messageTroubleshooting
- Group is empty. The task has not started, or the
awslogsdriver points at a group the execution role cannot write to. Check the task's last status and the execution role policy. - Service name is generic.
servicecomes from the last part of the group name, so name the group/ecs/<your-service>rather than a shared group. - Metrics missing. The metrics stack is separate from the logs stack and a fresh metric stream can take 3 to 15 minutes. Run
bash aws-metrics.sh --verify-only.
Next
- AWS: logs and metrics: the one CloudFormation stack this page feeds into.
- Running on AWS: ECS traces with an OpenTelemetry Collector sidecar.