I am experiencing an issue with my ECS cluster and want to gather log files for troubleshooting purposes. What kind of logs do I need and how do I easily collect them?

You want to collect log files to troubleshoot an issue related to ECS or Docker; however, you do not know where or how to search for these files, or how to enable debugging at both the Docker and ECS levels. You can use the ecs-logs-collector tool to gather these log files for you.

Download and install the ecs-logs-collector script from AWS labs on GitHub; for additional information, see the readme file at https://github.com/awslabs/ecs-logs-collector. Reproduce the issue on the ECS instance and run the script.

Consider the following sample code and run as root user:

# wget https://raw.githubusercontent.com/awslabs/ecs-logs-collector/master/ecs-logs-collector.sh

# bash ecs-logs-collector.sh

This script enables debugging for Docker and ECS agent (only available for Amazon Linux), and a zip file is created containing logs for OS, Docker, and ECS agent. These logs can be provided to AWS Support for debugging and troubleshooting.

Note: This script restarts the ECS agent and Docker, causing all running containers on the instance to stop. Only tasks that are part of a service are restarted automatically. Any containers that are managed outside of ECS (cAdvisor, log collectors, etc.) are not restarted unless they have been configured to do so.

ECS, Docker, logs, debug, ecs-logs-collector, OS logs, OS settings, Docker logs, ECS agent logs, Enable Debug Mode for Docker, Enable Debug Mode for ECS agent, Linux, Red Hat Enterprise Linux 7, Debian 8

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-10-04