How to get the log from an application deployed using docker on AWS ecs

ecs application logs
fargate requires task definition to have execution role arn to support log driver awslogs.
getting ecs logs
aws ecs scheduled tasks logs
ecs log storage
ecs docker log rotation
ecs log file location
ecs agent logs path

I have a backend application running on node.js with feathers.js framework. I have deployed it using docker and it is currently maintained by AWS ECS.

In my application, I have a few lines of 'console.log' to display some Strings for debugging purposes. I am wondering when I have deployed the application on AWS ECS, where is console.log printed to and how do I access it?

You have to create a log group on ECS:

Follow these steps to create your log group-

Step 1: Open the Amazon ECS console at

Step 2: In the left navigation pane, choose Task Definitions, Create new Task Definition.

Step 3: Choose your compatibility option and then Next Step.

Step 4: Choose Add container to begin creating your container definition.

Step 5: In the Storage and Logging section, for Log configuration choose Auto-configure CloudWatch Logs.

Step 6: Enter your awslogs log driver options. For more details, see Specifying a Log Configuration in your Task Definition.

Step 7: Complete the rest of the task definition wizard.

After creating your log view you can see it by using below steps:

Step 1: Open the CloudWatch console at

Step 2: In the navigation pane, choose Logs.

Step 3: For Log Groups, choose the log group to view the streams.

Step 7: For Log Streams, choose the log stream name to view the log data.

For more details:

Working with Log Groups and Log Streams

Using the awslogs Log Driver

Amazon ECS Log File Locations, Amazon ECS stores logs in the /var/log/ecs folder of your container instances. You can view these log files by connecting to a container instance using SSH. from cleanup: amazon/amazon-ecs-agent:latest" module=parse.go level=info 2016-08-15T15:54:41Z [INFO] Detected Docker versions [1.17 1.18 1.19 1.20 1.21  Now that you have learned to deploy your Docker-enabled application to Amazon ECS, you can progress to the next tutorial where you will learn how to create a Docker Registry to store your container images. You’ll build a Docker image, push it to a repository and then use it to deploy an application on Amazon ECS. Create a Docker Registry.

In your container definition you need to mention the log configuration. Since Its unclear whether you are creating the ecs cluster using cloudformation / from gui console, I will try to answer for both ways.

1. GUI console:

2. Using cloudformation template:

    "containerDefinitions": [
            "name": "nodejsApplication",
            "links": [
            "image": "nodejsApplication",
            "essential": true,
            "portMappings": [
                    "containerPort": 80,
                    "hostPort": 80
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "awslogs-nodejsApplication",
                    "awslogs-region": "us-west-2",
                    "awslogs-stream-prefix": "awslogs-example"
            "memory": 500,
            "cpu": 10

For more details please follow Using Awslogs

Using the awslogs Log Driver - Amazon ECS, / . On the Clusters page, select the cluster that contains the task to view. On the Cluster: cluster_name page, choose Tasks and select the task to view. AWS announced that its customers can now configure their ECS apps deployed in EC2 mode to access EFS file systems. This is good news for Docker developers who use Amazon ECS because ECS now natively integrates with Amazon EFS to automatically mount shared file systems into Docker containers.

console.log prints to STDOUT. A good way to collect this as logs is to use the awslogs log driver. This will route those logs to a CloudWatch Logs stream of your choice. Here is more information on what CloudWatch Logs and how you can use it.

Amazon ECS logs collector, Currently, the Amazon ECS logs collector supports the following operating systems: Getting started with AWS App Mesh and Amazon ECS · AWS Deep Learning After you have run the script, you can examine the collected logs in the collect This restarts the Docker daemon, which kills all containers that are running on  In this post, I will guide you through the process of deploying a Node app on AWS ECS with Terraform. If you are new to Docker, I highly recommend this course by Stephen Grider or the official…

ecs-cli logs - Amazon Elastic Container Service, Only valid for tasks that use the awslogs driver and have a log stream prefix specified. Important. Some features described might only be available with the latest  One of the projects has shared its docker-compose.yml file. It contains various services. Each service forms a container. I can easily deploy this image in EC2 and get going. However, I want to use AWS ECS only. How can I deploy that YML file in AWS ECS? Source: StackOverflow

The Seven Biggest Challenges of Deployment to ECS, Describe our app in docker-compose.yml as a set of Docker images and We don't have to operate a registry, we can use AWS EC2 Container Registry (ECR), Docker Hub or A CloudWatch Log Group for the app container logs. In the first article of my AWS Journey, we deployed a Docker image via the AWS web console. While this works fine, it includes manual work and doesn’t provide fine-grained control over the network and other resources we might need. The next step in this journey is to automate the deployment of Docker images.

Monitoring ECS with Datadog, Use Datadog to get visibility into ECS, and the services running on it, all on for ECS to include data from Docker, other AWS services, and ECS logs. You'll see application metrics from throughout your ECS deployment,  How to deploy a Docker app to Amazon ECS using AWS Fargate Deploy an app running on Docker that consists of an API service, worker, queue, and database without managing virtual machines Tony Pujals