DOP-C02 Question 210
Select 2Your organization runs a distributed application on Amazon ECS using Fargate. The team wants to collect logs and metrics from the application for centralized monitoring and analysis. They have the following requirements:
- Application logs should be available in real-time for troubleshooting.
- Metrics such as CPU and memory usage of ECS tasks should be visible in dashboards.
- The logging solution should minimize operational overhead.
Which combination of steps should you take to meet these requirements?
- A
Enable the AWS CloudWatch Logs agent on each ECS task and configure it to forward logs to CloudWatch Logs.
- B
Use the awslogs log driver for the ECS tasks to send container logs directly to Amazon CloudWatch Logs.
- C
Enable Container Insights for Amazon ECS to collect metrics such as CPU and memory usage automatically.
- D
Set up an Amazon Kinesis Data Firehose stream to forward logs to an S3 bucket for long-term storage.
- E
Use CloudWatch Logs Insights to create queries and generate dashboards for application logs.
Show answer and explanation
Correct answers: B, C
Explanation
To meet the requirements, the awslogs log driver should be used to send logs from ECS containers to CloudWatch Logs in real-time, and Container Insights for ECS should be enabled for automatic metrics collection. The other options involve unnecessary tools or configurations that do not align with the requirements of minimizing operational overhead or achieving real-time monitoring.
- A. Incorrect.
Incorrect: The AWS CloudWatch Logs agent is not supported in Fargate tasks. You cannot install agents inside Fargate containers as the underlying infrastructure is managed by AWS.
- B. Correct.
Correct: The awslogs log driver is the recommended way to send logs from ECS containers directly to Amazon CloudWatch Logs without requiring additional agents, making it suitable for Fargate.
- C. Correct.
Correct: Enabling Container Insights for ECS automatically collects and visualizes metrics such as CPU and memory usage, which aligns with the requirement to monitor these metrics in dashboards.
- D. Incorrect.
Incorrect: While Kinesis Data Firehose can be used for log delivery to S3, it is not necessary for this scenario since the requirement is real-time troubleshooting and monitoring, which is better served by CloudWatch Logs and Container Insights.
- E. Incorrect.
Incorrect: CloudWatch Logs Insights is a useful tool for querying logs and generating dashboards, but it is not a step required to configure the collection, aggregation, and storage of logs and metrics.