BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeAWS Certified DevOps Engineer - Professional (DOP-C02)CloudWatch Logs Subscriptions & Real-Time Processing Guide
Study Guide820 words

CloudWatch Logs Subscriptions & Real-Time Processing Guide

Processing log data by using CloudWatch log subscriptions (for example, Amazon Kinesis, AWS Lambda, Amazon OpenSearch Service)

CloudWatch Logs Subscriptions & Real-Time Processing

CloudWatch Logs subscriptions allow you to get a real-time feed of log events and deliver them to other AWS services for processing, analysis, or storage. This is a critical component for building automated monitoring and incident response systems in the AWS DevOps Professional domain.

Learning Objectives

By the end of this guide, you should be able to:

  • Explain the mechanics of CloudWatch Logs Subscription Filters.
  • Differentiate between Lambda, Kinesis Data Streams, and Kinesis Data Firehose as log destinations.
  • Describe the architectural flow of logs from EC2 to Amazon OpenSearch Service.
  • Configure cross-account log aggregation using subscriptions.

Key Terms & Glossary

  • Log Group: A group of log streams that share the same retention, monitoring, and access control settings.
  • Subscription Filter: A rule that defines which log events get delivered to a destination and where that destination is located.
  • Filter Pattern: A symbolic language used to search for specific terms or patterns (e.g., ERROR, 404) within log events.
  • Destination: The AWS resource (Lambda, Kinesis, or Firehose) that receives the log feed.
  • Amazon OpenSearch Domain: A managed cluster for searching, analyzing, and visualizing data (formerly Elasticsearch).

The "Big Idea"

In a standard setup, logs are stored in CloudWatch for searching and retention. However, CloudWatch is a storage service, not an analysis engine. Subscriptions represent the "push" mechanism that moves data from passive storage into active processing pipelines. This enables real-time reactions—like using Lambda to block an IP address after seeing too many failed logins or using Kinesis to feed a Big Data dashboard.

Formula / Concept Box

ComponentRequirementRole
Filter PatternCase-sensitive string or JSON patternDecides which logs are sent.
Destination ARNLambda, Kinesis, or Firehose ARNDecides where logs are sent.
IAM Role/PolicyPermissions for CloudWatch to Put logsDecides if the transfer is allowed.

[!IMPORTANT] A Log Group can have multiple subscription filters, but each filter can only have one destination.

Hierarchical Outline

  1. Ingestion Layer
    • CloudWatch Unified Agent: Installed on EC2/On-Prem to send logs to CloudWatch.
    • Log Groups: Logical containers for logs.
  2. Processing Layer (Subscriptions)
    • AWS Lambda: Ideal for light processing (masking PII, simple alerts).
    • Amazon Kinesis Data Streams: High-throughput, real-time streaming for multi-consumer apps.
    • Amazon Data Firehose: Near real-time loading into S3, Redshift, or OpenSearch.
  3. Analysis & Visualization Layer
    • Amazon OpenSearch Service: Advanced full-text search and ELK stack (Kibana).
    • CloudWatch Logs Insights: Ad-hoc SQL-like queries directly in the console.

Visual Anchors

Log Processing Flow

Loading Diagram...
Figure 1 — Mermaid diagram

Architectural Components

Compiling TikZ diagram…
⏳
Running TeX engine…
This may take a few seconds
Figure 2 — TikZ diagram

Definition-Example Pairs

  • Term: Cross-Account Subscription

    • Definition: Sending logs from one AWS account to a Kinesis stream in a centralized security account.
    • Example: A "Dev" account sends its VPC Flow Logs to a "Security" account for centralized threat detection.
  • Term: Filter Pattern Syntax

    • Definition: A specific syntax used to match strings or numeric ranges in log data.
    • Example: [w1, w2, w3="*Exception*", ...] matches any log event containing the word "Exception".

Worked Examples

Scenario: Masking PII Data in Logs

Requirement: Ensure that any log containing a Social Security Number (SSN) pattern is masked before being sent to an analysis tool.

  1. Step 1: Create a Lambda function. Write code that receives the base64-encoded, Gzip-compressed log data, decompresses it, regex-replaces SSNs with ***-**-****, and forwards it to S3.
  2. Step 2: Grant Permissions. Add a resource-based policy to the Lambda function allowing logs.amazonaws.com to invoke it.
  3. Step 3: Create Subscription Filter. In the CloudWatch console, select the Log Group, go to "Subscription Filters" -> "Create Lambda subscription filter", and select your function.
  4. Verification: View the destination S3 bucket to confirm logs arrive with masked values.

Checkpoint Questions

  1. What is the primary difference between a Metric Filter and a Subscription Filter?
    • Answer: A Metric Filter extracts numerical data to create a CloudWatch Metric (e.g., counting errors), while a Subscription Filter streams the entire log event to a destination for processing.
  2. True or False: Subscription data is delivered in plain text.
    • Answer: False. The data is delivered in base64-encoded, GZIP-compressed format to save bandwidth and improve performance.
  3. Which service should you use if you want to load logs into Amazon OpenSearch with minimal coding?
    • Answer: Amazon Data Firehose (it has a built-in destination for OpenSearch).

Muddy Points & Cross-Refs

  • Encoding/Compression: Many learners forget that Lambda receives logs in a compressed format. You must use zlib (Python) or gzip (Node.js) to decompress the data before you can read the log events.
  • Latency: Kinesis Data Streams provide sub-second latency, whereas Kinesis Data Firehose has a minimum buffer interval (usually 60 seconds), making it "near real-time" rather than "real-time."

Comparison Tables

Subscription Destinations

DestinationLatencyUse CaseComplexity
Lambda< 1sSimple transformations, triggering alerts, or masking.Low-Medium
Kinesis Data Streams< 1sHigh-scale ingestion for multiple custom consumers.High
Kinesis Data Firehose1-15 minLoading data into S3, OpenSearch, or Redshift.Low
OpenSearch (via Lambda/Firehose)1-5 minFull-text search, Kibana dashboards, root cause analysis.Medium-High
All AWS Certified DevOps Engineer - Professional (DOP-C02) Study Resources

Related Notes

  • Mastering AWS Alerting and Automated Remediation1,050 words
  • Study Guide: Analyzing Failed Deployments in AWS940 words
  • Incident Analysis: Troubleshooting Failed Processes in AWS1,050 words
  • Mastering AWS Monitoring & Security Analytics: Logs, Metrics, and Findings1,050 words
  • AWS Log Analysis: Athena, CloudWatch Insights, and OpenSearch920 words
  • Analyzing Real-Time Log Streams with Amazon Kinesis Data Streams985 words
  • CloudWatch Anomaly Detection Alarms: Professional Study Guide820 words
  • AWS Application Storage Patterns: EBS, EFS, and S31,054 words
  • Lab: Automating Security Controls and Data Protection with AWS Secrets Manager and Config942 words
  • Master Study Guide: Automating Security Controls & Data Protection (AWS DOP-C02)1,184 words
  • Mastering AWS CloudFormation StackSets: Multi-Account & Multi-Region Orchestration895 words
  • Mastering System Configuration Changes in AWS945 words

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up.

Start Studying

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free
AWS Certified DevOps Engineer - Professional (DOP-C02) ResourcesExplore All HivesBlogHome

© 2026 BrainyBee. Free AI-powered exam prep.

Loading Diagram...
Flowchart, left to right. Source (EC2/Lambda) connects to CloudWatch Log Group. B connects to Subscription Filter. C connects to Lambda (Processing). C connects to Kinesis Stream (Aggregation). C connects to Firehose (Storage/Search). F connects to Amazon OpenSearch. F connects to Amazon S3.