Looking for how to configure log driver for ECS tasks on AWS Fargate? We can help you with this!
As a part of our AWS Support Services, we often receive similar requests from our AWS customers.
Today, let’s see the steps followed by our Support Techs to help our customers to configure log drivers for ECS tasks on AWS Fargate.
Configure log driver for ECS tasks on AWS Fargate
The logs generated by the Fargate tasks are not automatically shown on the AWS Console. To view logs of ECS containers and Fargate tasks, we will need to configure a log driver. When creating a task definition for AWS Fargate, there is an option for allowing Amazon ECS to auto-configure your Amazon CloudWatch logs.
Now let’s see the steps to use the log group auto-configuration option to configure the log driver.
- Log in to the AWS management console and then open the Amazon ECS console.
2. Then select the Task Definitions, and then select Create new Task Definition.
3. Select FARGATE from the Select launch type compatibility section and then select Next Step.
4. Enter a name for the task definition for Task Definition Name from the Configure task and container definitions section.
5. Select Add container in the Container Definitions.
6. Based on our container requirements we can fill the needed fields.
7. Select any of the following options for Log configuration in the STORAGE AND LOGGING section:
Select the Auto-configure CloudWatch Logs check box if we want to accept the default values of awslogs-group, awslogs-region, and awslogs-stream-prefix. Then, skip to 9th step.
Or untick Auto-configure CloudWatch Logs check box if we want a custom log group.
8. If we want a custom log group and stream then we need to complete the following steps :
Steps to configure custom log group and stream
1. Select awslogs for Log driver. We need to set the awslogs-create-group parameter and use the required logs:CreateLogGroup action for the task execution if the log group doesn’t exist.
2. awslogs-group key: log group to which awslogs driver sends its log streams. Here leave the auto-populated value in place, or if the text box is empty enter a value for the group. (Required: Yes)
3. awslogs-region key: the region to which your awslogs driver sends its logs. Here leave the auto-populated value in place, or if the text box is empty, enter a value for your AWS Region. (Required: Yes)
4. awslogs-stream-prefix key: allows us to associate a log stream with the specified prefix, the container name, and the ID of the ECS task. Here leave the auto-populated value in place, or if the text box is empty enter a value for your stream. (Required: Yes)
9. Select Add.
10. Fill the remaining fields on the task definition page.
11. Select Create.
[Need help with more AWS queries? We’d be happy to assist]
Conclusion
To conclude, today we discussed the steps followed by our Support Engineers to help our customers to configure log driver for ECS tasks on AWS Fargate.
0 Comments