Skip to main content
Welcome, engineers. This lesson covers Domain 4 — Monitoring and Logging — at a high level and explains why metrics, logs, and traces are essential. Domain 4 represents roughly 15% of the AWS Certified DevOps Engineer – Professional (DOP‑C02) exam and is one of the four core domains for that certification.
Domain focus for the exam: prioritize Amazon CloudWatch (Metrics, Logs, Alarms, Dashboards, Logs Insights, Container/Lambda Insights, Synthetics, ServiceLens) and AWS X‑Ray for tracing. The AWS Distro for OpenTelemetry (ADOT) is relevant for instrumentation, but the exam emphasizes native CloudWatch/X‑Ray features.
A presentation slide titled "Domain 4 – Overview" with three colored panels summarizing Exam Weight (15% of DOP-C02), Three Pillars (Metrics, Logs, and Traces), and AWS Services (CloudWatch suite and X‑Ray). The panels give a brief overview of observability topics for the AWS DevOps Pro certification.
In modern distributed systems observability rests on three pillars: metrics, logs, and traces. Dashboards typically combine these signals, often augmented with event correlation and business telemetry. For operational troubleshooting and exam scenarios, metrics, logs, and traces are the fundamental building blocks. So that’s what we’ll focus on.

Why observability matters — a realistic nightmare

Imagine you are on-call for a large e‑commerce platform with hundreds of microservices. At 03:00 you receive a page: checkout is failing. Traffic recently spiked from 5,000 requests/sec to 50,000 requests/sec (10×). It could be a flash sale, a bot attack, or a bad release. Revenue is dropping. Without observability you lack fast answers: Did autoscaling fail? Is a dependency timing out? Is there a code regression? Poor observability forces ad-hoc troubleshooting: SSH’ing random instances, grep’ing logs, restarting services, and paging the whole team — all of which increase mean time to resolution (MTTR). With good observability you locate the failing service quickly, examine logs for context, use traces to see the request path, and restore service in minutes — saving revenue and customer trust.
A presentation slide showing a microservices diagram where a central "Checkout is failing" service is receiving heavy traffic (50,000 requests/second) from multiple microservices. A note at the bottom warns revenue is dropping $25,000 per minute.
A presentation slide titled "The Observability Problem: The Nightmare Scenario" comparing "Without Observability" (blind troubleshooting, random log digging, restarting services, waking the whole team, long time to find issues) with "With Observability" (find failing service in minutes, see root cause instantly, fix it fast). The slide is from KodeKloud.

The three pillars — concise definition

  • Metrics: what is happening (numerical, time-series).
  • Logs: why it happened (event-level context).
  • Traces: where it happened (distributed request path and latency).
A slide titled "The Three Pillars of Observability" showing three colored panels labeled Metrics, Logs, and Traces. Each panel contains bullet points explaining what each pillar measures (what is happening, why it's happening, and where in the system).

Deep dive — Metrics

Metrics are numerical time-series data collected at regular intervals. Sampling frequency and dimensionality must match your operational and business needs — high-frequency financial systems differ from a typical SaaS API. Key characteristics and uses:
  • Aggregated values (sum, min, max, count).
  • Lightweight metrics that tolerate high-cardinality (design carefully).
  • Real-time alerting when thresholds are breached.
  • Long-term trend analysis for capacity planning and regression detection.
Typical metric categories:
  • Infrastructure: CPU, memory, disk I/O, network throughput.
  • Application: request count, error rate, response latency.
  • Business: orders/minute, conversion rate, revenue.
Infrastructure and application metrics often feed business metrics (e.g., increased errors reduce orders/minute).
A slide titled "Metrics Deep Dive" that explains metrics are numerical time-series data and shows a line chart of Value vs Time with connected points, rising overall but with several fluctuations.
A presentation slide titled "Metrics Deep Dive" with a colorful semicircular infographic highlighting key characteristics: Aggregated values, Lightweight, Real-time alerting, and Long-term trends, each with icons and brief descriptions. The slide includes a small "© Copyright KodeKloud" notice at the bottom.
A slide titled "Metrics Deep Dive" showing three colored arrows for common metric types. The arrows label Infrastructure (CPU, memory, disk I/O, network throughput), Application (request count, error rate, response time), and Business (orders per minute, conversion rate, revenue).
Practical metric tip for AWS
  • CloudWatch supports up to 10 dimensions per metric — choose dimensions that provide meaningful context without exploding cost and cardinality.

Deep dive — Logs

Logs record event-level details and system state. Two main approaches:
  • Unstructured text logs (free-form human-readable): flexible, but harder to query at scale.
  • Structured logs (JSON or agreed schema): easier to parse, query, and correlate.
Structured logging is strongly recommended. Include correlation IDs to trace requests across services and ensure consistent fields for automated analysis. Examples: Plain text:
Structured JSON:
A presentation slide titled "Logs Deep Dive" showing a "Log Organization" diagram with three colored branches. The branches are labeled "Log Streams" (track individual log sequences), "Log Groups" (organize related log streams), and "Retention Policies" (balance compliance and storage costs).
Operational patterns with CloudWatch Logs:
  • Organize logs into Log Groups (service/application) and Log Streams (individual instances or tasks).
  • Use CloudWatch Logs Insights for querying and ad-hoc analytics.
  • Apply retention policies to control cost and comply with regulations.
  • Consider sampling or dynamic log levels for high-volume services.
Best practices:
  • Use structured JSON logs and a consistent schema.
  • Include correlation IDs and contextual metadata (e.g., request_id, user_id, region).
  • Sample high-volume logs (or filter) to reduce storage and ingestion costs.
  • Implement lifecycle rules: keep hot logs in CloudWatch, archive older logs to S3/Glacier for compliance.
A slide titled "Logs Deep Dive" with a stylized brain in the center and the heading "Best Practices." Around it are four tips: use structured (JSON) logging, include correlation IDs for request tracking, implement log sampling for high-volume systems, and set appropriate periods.

Deep dive — Traces

Tracing captures the path of a request as it flows through multiple services, revealing latency hotspots and failed components. Distributed tracing is essential when a single request touches many microservices. AWS tracing options:
  • AWS X‑Ray: sampling, service maps, trace visualization, annotations, metadata.
  • AWS Distro for OpenTelemetry (ADOT): OpenTelemetry instrumentation that can emit to AWS backends.
  • Third-party systems: Jaeger, Zipkin (useful but exam focus is X‑Ray/ADOT).
Traces help answer questions like: which downstream service added the most latency? Which dependency returned errors for a specific request?
A colorful infographic titled "Traces Deep Dive" that diagrams a distributed request flow through API Gateway, a Lambda function, DynamoDB and S3, ending with the response returned to the client. The steps are shown as connected semicircles with icons and brief labels for each stage.
Service maps and trace inspection let you visualize traffic between services, view per-edge error rates and latency, and quickly focus your investigation.
A slide titled "Traces Deep Dive" showing a service map: blue circular nodes labeled Service A–E connected by arrows with percentages and red warning icons indicating traffic flows and error rates.
A slide titled "Traces Deep Dive" listing key tracing tools, with icons and labels for AWS X‑Ray, Jaeger, Zipkin, and AWS Distro for OpenTelemetry.

How metrics, logs, and traces work together (investigation workflow)

A typical troubleshooting workflow:
  1. Metric alert fires (CloudWatch Alarm) — indicates an error or capacity breach.
  2. Inspect logs (CloudWatch Logs + Logs Insights) — find patterns, timestamps, and stack traces.
  3. If deeper context is needed, analyze traces (X‑Ray) — identify slow services and dependency latencies.
  4. Determine root cause and remediate (code fix, configuration change, scaling, RDS Proxy, etc.).
Example: database connection timeouts
  • Metrics: elevated DB timeout rate triggers an alarm.
  • Logs: repeated 30s connection timeouts appear in application logs.
  • Traces: X‑Ray shows spike in DB connection pool waits and unreleased connections.
  • Fix: code to ensure connections are released; alternatively use RDS Proxy or connection pooling.
A presentation slide titled "How They Work Together?" showing a timeline for a real scenario: Database Connection Timeout. It lists steps: metric alert fires (CloudWatch), check logs, analyze X‑Ray trace, and find the root cause of unreleased database connections.

AWS services mapping (quick reference)

Most monitoring and observability features are within the CloudWatch family; tracing is handled by X‑Ray and integrates into CloudWatch ServiceLens.
A slide titled "AWS Services Mapping" with four columns—Metrics, Logs, Traces, and Unified—each displaying an icon and related AWS services. Examples listed include Amazon CloudWatch, CloudWatch Logs, AWS X‑Ray, and CloudWatch Application Insights.

Real-world scenarios and exam-relevant examples

  • Compliance / audit retention: retain audit logs for compliance (for example, SOX often requires multi‑year retention). Typical pattern: forward CloudWatch Logs to S3 (and Glacier) for long-term retention, while keeping recent data (e.g., 90 days) readily available in CloudWatch.
A presentation slide titled "Real‑World Exam Scenarios" showing "Scenario 1: Compliance Requirements." It says to retain audit logs for 7 years (SOX) and recommends using CloudWatch Logs → S3/Glacier for long‑term retention while keeping 90 days in CloudWatch.
  • Cost optimization at scale: when logs exceed terabytes/day, apply sampling and filtering. Send only high-priority logs (ERROR/WARN) to CloudWatch for real-time alerts; route lower-priority or debug logs to S3 for batch analysis.
A presentation slide titled "Real-World Exam Scenarios" showing "Scenario 2: Cost Optimization at Scale." It states an app generates massive debug logs (10 TB/day) and suggests applying log sampling/filtering, sending errors to CloudWatch, and streaming INFO logs to S3.
  • Multi-account aggregation: use CloudWatch cross-account observability patterns and centralized logging (aggregator accounts). AWS Control Tower and well‑architected landing zones help standardize accounts, but you still need centralization architecture for observability.
  • Real-time vs batch processing: for real-time detection (fraud, alerts) stream logs to Lambda or Amazon Kinesis Data Streams/Data Firehose for continuous processing, while simultaneously writing full logs to S3 for batch analytics (Amazon Athena, EMR, or AWS Glue).
A presentation slide titled "Real-World Exam Scenarios — Scenario 4: Real-Time vs Batch Processing." It states the need for real-time fraud alerts plus batch analytics and suggests CloudWatch Logs → Lambda for real-time with a parallel stream to S3/Athena for batch.

Common exam traps and anti-patterns

  • Multiple subscription filters per log group: CloudWatch Logs cannot natively attach multiple subscription destinations directly to the same log group for fan-out. Use Kinesis Data Firehose or a streaming layer to fan out to multiple sinks.
  • Storing everything forever: avoid infinite retention in CloudWatch Logs. Use lifecycle policies to tier logs (hot/warm/cold) and archive older logs to S3/Glacier.
  • No structured logging: plain-text logs are hard to query and correlate; standardized JSON logs improve searchability and automation.
  • Tracing everything indiscriminately: full sampling at 100% can be expensive and noisy. Use intelligent sampling strategies and enable higher fidelity only where it helps diagnosis.
Exam warning: do not rely on unlimited retention or unlimited tracing. Cost and cardinality constraints are common exam topics — design telemetry with retention policies, sampling, and cost-control in mind.
A slide titled "Common Exam Traps and Anti-Patterns" showing four colored boxes that list pitfalls (Multiple Subscription Filters, Storing Everything Forever, No Structured Logging, Tracing Everything) with brief "Trap" and "Reality" explanations for each. Copyright KodeKloud appears at the bottom.

Troubleshooting advice

When troubleshooting distributed systems, narrow the scope gradually: metrics → logs → traces. Increase fidelity only for the affected area; avoid turning up global verbosity, which creates noise and additional cost.

Looking ahead — Domain 4 learning path

This domain includes:
  • Foundations of observability
  • Collecting, aggregating, and processing logs at scale
  • Metrics and dashboards
  • Alarms and notifications
  • Tracing and Application Insights (ServiceLens / X‑Ray)
  • Auditing, real-time analysis, and alerting
Hands-on labs are essential: practice CloudWatch metrics/alarms, Logs Insights queries, creating service maps in X‑Ray, and driving retention/archival flows to S3/Glacier.
A slide showing a winding roadmap titled "Domain 4 – Looking Ahead" and "Your Complete Learning Journey." It marks milestones for observability and logging topics (Foundations of Observability; Collecting, Aggregating and Processing Logs; Metrics and Dashboards; Alarms and Notifications; Tracing and Application Insights; Auditing and Real‑Time Analysis & Alerting).

Key takeaways

  • Metrics tell you what is happening — numerical trends and alerts for capacity and performance.
  • Logs explain why it happened — event context and state, best if structured and correlated.
  • Traces show where it happened — end-to-end request visibility and dependency analysis.
Use all three pillars together (plus dashboards and event correlation) to detect, diagnose, and pinpoint failures quickly.
A presentation slide titled "Key Takeaways" with a blue gradient panel on the left and three numbered markers on the right. It summarizes: 01 Metrics tell you what is happening, 02 Logs explain why it happened, and 03 Traces show where it happened.

Watch Video