BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeAWS Certified DevOps Engineer - Professional (DOP-C02)AWS DevOps Professional: Service and Application Logging Strategy
Study Guide925 words

AWS DevOps Professional: Service and Application Logging Strategy

Configuring service and application logging (for example, CloudTrail, Amazon CloudWatch Logs)

AWS DevOps Professional: Service and Application Logging Strategy

This study guide covers the critical aspects of configuring, aggregating, and analyzing service and application logs within the AWS ecosystem, specifically focusing on Amazon CloudWatch Logs and AWS CloudTrail for the DOP-C02 exam.

Learning Objectives

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

  • Configure application log collection using the CloudWatch Agent.
  • Implement log aggregation across multiple AWS accounts and regions.
  • Design log processing pipelines using subscriptions to Kinesis, Lambda, or OpenSearch.
  • Audit API activity using CloudTrail and distinguish between management and data events.
  • Enforce security for log data using AWS KMS encryption and IAM least-privilege policies.

Key Terms & Glossary

  • Log Group: A group of log streams that share the same retention, monitoring, and access control settings.
  • Log Stream: A sequence of log events that share the same source (e.g., a specific instance ID).
  • CloudWatch Agent: A software package installed on EC2 instances or on-premises servers to collect internal system-level metrics and log files.
  • Metric Filter: A feature that searches for and matches terms or patterns in log data to turn them into numerical CloudWatch metrics.
  • CloudTrail Trail: A configuration that enables delivery of events as log files to an S3 bucket.
  • Log Subscription: A way to get a real-time feed of log events from CloudWatch Logs and have them delivered to other services like Amazon Kinesis or Lambda.

The "Big Idea"

Logging is the foundation of the Feedback Loop in DevOps. Without centralized, immutable, and searchable logs, root cause analysis (RCA) and automated incident response are impossible. AWS provides a dual-layer approach: CloudWatch monitors the "inside" (what the application and OS are doing), while CloudTrail monitors the "outside" (who is making API calls to change the environment).

Formula / Concept Box

ConceptStandard SettingHigh-Resolution / Detailed
CloudWatch Metrics5-minute periods1-minute periods (or 1-second for custom)
CloudWatch AgentDefault push: 5 secondsConfigurable in common-config.toml
CloudTrail Delivery~15 minutes post-API callNear real-time via EventBridge
Log RetentionIndefinite (default)1 day to 10 years (configurable)

Hierarchical Outline

  1. Log Ingestion and Collection
    • Standard Service Logs: S3 Access Logs, VPC Flow Logs, ELB Logs (delivered to S3 or CloudWatch).
    • Application Logs: Collected via CloudWatch Agent (installed via Systems Manager) or the awslogs driver in Docker/ECS.
    • Custom Metrics: Pushed via PutMetricData API or extracted via Metric Filters.
  2. Processing and Analysis
    • CloudWatch Logs Insights: A purpose-built query language for fast, interactive log searching.
    • Subscriptions: Fan-out logs to Kinesis Data Firehose for delivery to S3/OpenSearch or AWS Lambda for real-time remediation.
    • Metric Streams: Low-latency delivery of CloudWatch metrics to third-party providers (Datadog, New Relic) or S3.
  3. Governance and Security
    • Encryption: Use AWS KMS to encrypt logs at rest within CloudWatch Log Groups.
    • Cross-Account Logging: Centralizing logs in a dedicated "Security/Audit" account using S3 bucket policies and CloudTrail organization trails.

Visual Anchors

Log Ingestion Flow

Loading Diagram...
Figure 1 — Mermaid diagram

Metric Filter Logic

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

Definition-Example Pairs

  • CloudWatch Subscription Filter

    • Definition: A filter that determines which log events are sent to a destination service.
    • Example: Sending only logs containing the keyword "CRITICAL" to an AWS Lambda function that triggers a PagerDuty alert.
  • CloudTrail Data Events

    • Definition: Resource-level operations that are high-volume and disabled by default to save costs.
    • Example: Logging every GetItem call in a DynamoDB table or GetObject in an S3 bucket for forensic auditing.
  • Metric Dimensions

    • Definition: Name-value pairs that are part of the identity of a metric, used to filter and aggregate data.
    • Example: Monitoring CPU utilization with dimensions like InstanceID or AutoScalingGroupName.

Worked Examples

1. Creating a Metric Filter for Application Errors

Scenario: You want to monitor the number of 404 errors in your Nginx logs.

  1. Define Pattern: [ip, user, id, time, request, status_code=404, size]
  2. Create Filter: Go to CloudWatch > Log Groups > (Your Group) > Metric Filters > Create.
  3. Assign Value: Set the metric value to 1 for every occurrence.
  4. Alarm: Create a CloudWatch Alarm on this new metric to trigger if 404s exceed 50 in 5 minutes.

2. Centralizing CloudTrail Across Multiple Accounts

Scenario: You have 4 accounts and want all logs in a "Security" account.

  1. Security Account: Create an S3 bucket (e.g., company-audit-logs).
  2. Bucket Policy: Update policy to allow cloudtrail.amazonaws.com to PutObject from all account IDs in the Org.
  3. Member Accounts: Enable CloudTrail and point the S3 destination to the bucket in the Security Account.

Checkpoint Questions

  1. What is the main difference between CloudWatch Basic and Detailed monitoring for EC2?
  2. How can you ensure logs are kept for only 30 days to optimize costs?
  3. Which service is better for tracking "Who deleted the production database?" CloudWatch or CloudTrail?
  4. What mechanism allows you to stream logs from CloudWatch to Amazon OpenSearch Service in real-time?
▶Click for Answers
  1. Basic monitoring sends data every 5 minutes (free); Detailed monitoring sends data every 1 minute (extra cost).
  2. Set a 30-day Retention Policy on the CloudWatch Log Group.
  3. CloudTrail (it tracks API activity including the identity of the caller).
  4. CloudWatch Logs Subscription Filters.

Muddy Points & Cross-Refs

  • Log Ingestion Latency: Users often confuse "Real-time" with "Near real-time." CloudWatch agent default is 5s, but CloudTrail can take up to 15m. For instant security reaction, use EventBridge rules for API calls rather than waiting for CloudTrail logs.
  • KMS Key Policy: When encrypting Log Groups, the KMS key policy must grant permissions to the CloudWatch Logs service principal (logs.<region>.amazonaws.com).

Comparison Tables

FeatureAWS CloudTrailAmazon CloudWatch Logs
FocusManagement & Data API eventsApplication & System logs
Default Retention90 days (Event History)Indefinite
Primary StorageS3CloudWatch Log Groups
Main Use CaseCompliance, Auditing, SecurityTroubleshooting, Performance, Monitoring
PricingFirst copy of Management Events is freeBased on ingestion (GB), storage, and queries
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. EC2 / On-Prem connects to CloudWatch Logs ("CW Agent"). AWS Services connects to AWS CloudTrail ("API Activity"). B connects to Subscription?. E connects to Lambda / Kinesis ("Yes"). E connects to Log Storage ("No"). D connects to G. G connects to S3 / Glacier.