简体   繁体   中英

ECS container debugging process

How can I access my ECS container task if it is terminated with a successful event for the debugging process to ensure my logs are available?

As of now, I am able to go inside my container with the ecs-exec command whenever a new task is created to check the logs, and the container is in a running state.

My question is: if a container is terminated with a successful event, how can I access that particular container to view the logs?

How can I access my ECS container task if it is terminated

Once a container is terminated, it doesn't exist anymore. You can't access it at that point. This is like asking how you can use your computer when it is turned off.

You should configure your ECS tasks to log to AWS CloudWatch Logs . Then you will be able to view the logs in CloudWatch without needing to access the container.

For a terminated container, you would need to store the logs in either AWS Native logging solution eg CloudWatch wherein you would use awslog driver in your ECS task definition or you use a 3rd party logging solution wherein you can use AWS FireLens to push logs to 3rd party logstorage system. Firelens would also make sense if you want to ship to CloudWatch and perform upfront filtering

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM