Skip to main content
Welcome. This page summarizes Domain 4 (Monitoring and Logging) for the AWS Certified DevOps Engineer — Professional exam. Domain 4 is worth ~15% of the exam and centers on three observability pillars: collect telemetry, analyze it, and automate responses.
Guiding principle: You can’t fix what you can’t see. Design monitoring so you can observe the behavior you need to act on.
A slide titled "Domain 4 at a Glance" that summarizes exam weight (15% of the AWS DevOps Professional exam), three task statements (log collection, metric analysis, and automated responses), and the core focus (Collect, Analyze, Automate). It also includes the guiding principle: "You can't fix what you can't see."

1) CloudWatch Logs — hierarchy, collection, and agents

CloudWatch Logs organizes log data in a three-level hierarchy that influences retention, querying, and alerting: Collection options by source:
  • EC2 / on-premises: CloudWatch Unified Agent (supports custom parsing, multiline logs, retries, and can emit metrics derived from logs).
  • Lambda: runtime automatically writes to CloudWatch Logs.
  • ECS: configure the task definition logging driver or run an agent on hosts.
  • EKS: use a logging DaemonSet (e.g., Fluent Bit) to forward container logs.
  • VPC Flow Logs: deliver to CloudWatch Logs or to S3.
If you need OS-level logs from EC2 in the exam context, the CloudWatch Unified Agent is the typical solution.
A presentation slide titled "Task 4.1: Log Collection Essentials" describing the CloudWatch Unified Agent. It lists agent features (runs on EC2/on‑prem, custom parsing, retries, ideal for traditional infra) and shows icons for common log sources: AWS Lambda, Amazon ECS, Amazon EKS, Amazon EC2, and Amazon VPC.

2) Subscription filters and fan‑out patterns

Constraint to know: each CloudWatch Log Group supports only one subscription filter. To deliver the same stream of log events to multiple downstream systems, implement a fan‑out pattern: Common fan‑out approach:
  1. Create a single subscription filter on the log group that forwards to a Kinesis Data Stream.
  2. Attach multiple consumers or use Kinesis Data Firehose delivery streams to route copies to OpenSearch, S3, Lambda, etc.
Cross-account subscriptions are supported but require careful IAM and destination configuration.
A presentation slide titled "The ONE Subscription Filter Limit" explaining that each log group supports only one subscription filter. It lists three steps: Understand the Constraint, Know Your Destinations, and Implement a Fan-Out Pattern.

3) CloudWatch Metrics, custom metrics, and metric filters

CloudWatch metrics concepts:
  • Namespace: a container for metrics (use custom namespaces for app metrics).
  • Dimension: key/value pairs to slice metrics (e.g., InstanceId, Environment).
  • Resolution: standard (1-minute) vs high-resolution (1-second).
  • Retention: metrics are retained per CloudWatch retention policies (up to 15 months for certain granularities).
Create and publish custom metrics:
  • Use the PutMetricData API to publish arbitrary metrics.
  • Configure the CloudWatch Agent to emit system or custom metrics derived from logs.
Metric filters:
  • Convert recurring patterns in log messages into numeric CloudWatch metrics (logs → metrics) without code changes.
  • Use metric filters to generate alarms or drive dashboards.
A diagram titled "Custom Metrics and Metric Filters" showing an application publishing metrics to CloudWatch Metrics via a CloudWatch Agent or the PutMetricData API. Examples listed include business metrics, application performance indicators, and custom health checks.
Metric filters are ideal when you need actionable metrics from unstructured logs without modifying application code.
A slide titled "Custom Metrics and Metric Filters" that diagrams unstructured log data being transformed by metric filters into actionable CloudWatch metrics. The caption reads "Create custom metrics without changing code."

4) CloudWatch Alarms — types, states, and actions

Alarm states:
  • OK
  • ALARM
  • INSUFFICIENT_DATA (no data to evaluate or insufficient history)
Alarm types:
  • Static threshold: trigger when a metric crosses a defined value.
  • Anomaly detection: uses historical data to model a baseline and alerts on anomalies (requires metric history).
  • Composite alarms: combine multiple alarms using boolean logic to reduce false positives.
Common alarm actions:
  • SNS notifications
  • Auto Scaling policy execution
  • EC2 actions (stop, terminate, recover)
  • Invoke Lambda
  • Route events through EventBridge for broader automation
To reduce false positives, prefer composite alarms and anomaly detection when historical data allows.
A presentation slide titled "Task 4.2: CloudWatch Alarms" with three colored panels summarizing Alarm States (OK, ALARM, INSUFFICIENT_DATA), Alarm Types (static threshold, anomaly detection, composite) and Alarm Actions (SNS notifications, auto scaling, EC2 actions, Lambda invocation).

5) CloudWatch Logs Insights — interactive querying and cost control

CloudWatch Logs Insights lets you interactively query log groups for diagnostics:
  • Extract fields and parse messages.
  • Filter, aggregate (stats), sort, and bin time-series data.
  • Use pre-built queries for common investigations (errors, request volume, latency).
Pricing tip: Logs Insights charges per GB scanned. Use time filters and targeted log groups to minimize costs.
CloudWatch Logs Insights charges per GB of data scanned. Always scope queries with time ranges and filters to control cost.
Example Logs Insights query (count ERROR messages in 5-minute bins):

6) Distributed tracing with AWS X‑Ray

X-Ray provides distributed traces to troubleshoot microservice interactions: Key concepts:
  • Trace: end-to-end request across services.
  • Segment: work performed by a single service.
  • Subsegment: finer-grained operations inside a segment.
  • Annotations: indexed key/value pairs for searching traces.
  • Metadata: non-indexed diagnostic data.
Features and benefits:
  • Service map: visual dependency graph with latencies, error rates, and request counts.
  • Sampling: default sampling reduces cost (first request each second + 5% additional). Customize sampling rules to tune volume vs fidelity.
Use X-Ray to identify latency hotspots, downstream errors, and performance bottlenecks across distributed systems.
A presentation slide titled "AWS X‑Ray for Distributed Tracing" that summarizes trace request flows and core components. It highlights end-to-end visibility and lists Segments, Subsegments, Annotations, and Metadata with brief descriptions.
A slide titled "AWS X‑Ray for Distributed Tracing" that lists three service map benefits: visual representation of service dependencies, shows latency/error rates/request counts, and identifies bottlenecks and failures. Below it are sampling rules noting a default sampling rate and the option for custom rules.

7) CloudTrail — audit logging and analysis

CloudTrail records API activity across your AWS account:
  • Captures management events (control plane) and optional data events (S3 object-level, Lambda invokes).
  • Data events can increase cost—enable selectively.
  • CloudTrail Insights surfaces unusual API activity patterns.
  • Best practice: enable a multi‑Region or organization trail and deliver logs to S3; optionally forward to CloudWatch Logs.
  • For interactive or large-scale querying of CloudTrail logs stored in S3, use Amazon Athena.
If the exam asks about auditing API calls or detecting abnormal API behavior, use CloudTrail and CloudTrail Insights.
A slide titled "CloudTrail for Audit Logging" showing the AWS CloudTrail icon and four feature boxes: API Call Logging, Event Types, Trail Scope, and Integration Points. It summarizes CloudTrail's audit logging capabilities and integration options.

8) Event-driven automation: EventBridge and AWS Config

EventBridge (central event router):
  • Routes events using event patterns (JSON filters) to targets (Lambda, SNS, SQS, Step Functions, Kinesis, API destinations).
  • Supports scheduled rules (cron/rate) for recurring tasks.
  • Use EventBridge to automate responses to CloudWatch alarms, resource events, and custom application events.
A slide titled "Task 4.3: Event-Driven Automation — Amazon EventBridge: Central Event Router" listing three features: 01 Event Patterns (JSON filters), 02 Target Options (Lambda, SNS, SQS, Step Functions, etc.), and 03 Scheduled Events (cron/rate-based schedules). Colored icons accompany each numbered item.
AWS Config (compliance and config monitoring):
  • Continuously records resource configuration state and changes over time.
  • Config Rules evaluate compliance; non‑compliant findings can trigger auto‑remediation (e.g., Systems Manager Automation).
  • Conformance packs bundle rules for standards (PCI DSS, HIPAA, CIS) or custom policies.
  • Useful for inventory, compliance reporting, and automated remediation of misconfigurations.
A presentation slide titled "AWS Config for Compliance Monitoring" with the AWS Config icon and three key benefits: continuous recording of resource configurations, tracking changes over time, and providing a complete audit trail. Below it are three feature boxes: Config Rules, Auto‑Remediation, and Conformance Packs.

9) Domain 4 Quick Hits (exam‑focused checklist)

Keep these exam-oriented facts top of mind:
  • CloudWatch Logs: one subscription filter per log group — use Kinesis Data Streams for fan‑out to multiple destinations.
  • Metric filters convert log patterns into CloudWatch metrics (logs → metrics) without changing code.
  • Alarms: anomaly detection and composite alarms are effective at reducing false positives (anomaly detection requires metric history).
  • X‑Ray: use traces and the service map to find cross‑service latency and error hotspots.
  • CloudTrail: record API calls; use CloudTrail Insights for anomalous activity and Athena to query logs stored in S3.
  • EventBridge: central router to automate responses (supports targets like Lambda, SNS, Step Functions).
  • AWS Config: continuous configuration recording, compliance evaluation, and automation via rules and conformance packs.
A slide titled "Domain 4 Exam Quick Hits" showing five colorful numbered gear icons labeled Subscription Filters, Metric Filters, X‑Ray, CloudTrail, and EventBridge. A gray banner at the top offers a study tip about integrating services for end-to-end monitoring and a final exam tip appears along the bottom.
Practical implementation summary: collect logs and metrics with agents and native service integrations, centralize to CloudWatch (and optionally OpenSearch or S3 for long-term storage/analysis), analyze with Logs Insights and X‑Ray, and automate responses via Alarms, EventBridge, Lambda, Systems Manager, or Auto Scaling. That completes the Domain 4 overview.

Watch Video