DOP-C02 Monitoring and Logging Practice Question
A company runs a containerized application on Amazon ECS with Fargate. They want to monitor the application logs and metrics. Which THREE steps should they take to collect and visualize this data? (Choose THREE.)
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a CloudWatch Dashboard to display logs and metrics.
CloudWatch Dashboards can display both logs and metrics, allowing visualization of application data collected from ECS tasks. Option C is correct because the awslogs log driver sends container logs to CloudWatch Logs directly from the ECS task definition. Option E is correct because the CloudWatch agent can be deployed as a sidecar container to collect custom metrics and logs from the application. Option B is incorrect because AWS CloudFormation is used for infrastructure provisioning and management, not for monitoring resource metrics. Option D is incorrect because AWS X-Ray is designed for tracing and analyzing requests, not for collecting logs or application metrics.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create a CloudWatch Dashboard to display logs and metrics.
Why this is correct
A CloudWatch Dashboard is a customizable operational view that consolidates CloudWatch Logs insights, metric graphs, and alarm states into a single pane. For an ECS workload, you can combine ECS service-level metrics, container instance metrics, and log-group-based insights to visualize application health and troubleshoot in near real time. This directly satisfies the requirement to display logs and metrics, making it a valid monitoring component.
- ✗
Use AWS CloudFormation to monitor resource metrics.
Why it's wrong here
AWS CloudFormation is an infrastructure-as-code service used to declaratively provision and manage AWS resources, such as ECS clusters, task definitions, and CloudWatch alarms. While a CloudFormation template can create metric alarms or dashboards, the service itself does not collect, store, or display any runtime metrics. Therefore, CloudFormation is a deployment orchestration tool, not a monitoring mechanism, and does not fulfill the requirement to monitor resource metrics.
- ✓
Configure the ECS task definition to use the awslogs log driver.
Why this is correct
Configuring the ECS task definition with the awslogs log driver allows the container's stdout and stderr to be automatically streamed to a specified CloudWatch Logs log group. This is done by setting the logConfiguration's logDriver to 'awslogs' and providing options such as awslogs-group, awslogs-region, and awslogs-stream-prefix. It is the standard way to collect container logs from ECS, but it only captures logs—it does not gather or visualize custom metrics, so it works alongside, rather than replaces, other monitoring components.
- ✗
Use AWS X-Ray to trace requests and collect logs.
Why it's wrong here
AWS X-Ray is a distributed tracing service that helps analyze and debug application requests as they travel across services, using trace segments and spans to provide an end-to-end view of request flows. While X-Ray can help identify latency bottlenecks and errors in an ECS microservices environment, it does not collect general application logs or emit CloudWatch-style resource metrics. Thus, X-Ray is focused on tracing and service topology, making it unsuitable as a log and metric collection tool for this scenario.
- ✓
Enable the CloudWatch agent as a sidecar container in the task definition.
Why this is correct
Running the CloudWatch agent as a sidecar container in the ECS task definition enables the collection of custom metrics from the application or container environment, such as memory usage, disk utilization, or application-specific counters, and publishes them to CloudWatch via the PutMetricData API. Because ECS natively provides only basic CPU and memory metrics, the sidecar agent fills gaps by gathering more granular operational data directly from inside the task. This is a valid way to collect custom metrics, though it does not independently provide a unified dashboard for displaying all logs and metrics.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.