skip to Main Content

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?

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search