Instiq
Chapter 1 · Monitoring, Logging, and Remediation·v2.0.0·Updated 6/3/2026·~9 min

What's changed: Deepened SOA-C02 Chapter 1 to Associate depth (tables, scenarios, FAQ, traps; localized figures)

1.2Log Aggregation and Audit (CloudWatch Logs and CloudTrail)

Key points

Understand aggregating app/OS logs with CloudWatch Logs and Logs Insights, auditing API activity (who did what) with CloudTrail, and when to use each.

Logs are essential for investigation and audit. On AWS, app/OS logs = CloudWatch Logs, while API activity records = CloudTrail.

1.2.1Logs and audit trail

Diagram contrasting CloudWatch Logs (aggregate app/OS/Lambda logs, query with Logs Insights, "what is my app doing?") with AWS CloudTrail (record API calls / who did what, account-wide audit, "who changed this resource?").
CloudWatch Logs vs. CloudTrail
  • CloudWatch Logs: aggregates app/OS/Lambda logs; query/analyze with Logs Insights.
  • Metric filter: turns log pattern occurrences (e.g., ERROR) into a metric you can alarm on.
  • CloudTrail: records API activity (who, when, what) for account-wide auditing.
Exam point

Common on SOA: who changed/deleted a resource = CloudTrail, investigate app/OS logs = CloudWatch Logs, alarm on a word’s occurrence in logs = metric filter + alarm. Don’t confuse them.

Separate them by role. CloudWatch Logs aggregates logs to see "what apps/OS are doing," organized into log groups / log streams and analyzed across with the Logs Insights query language. Counting occurrences of a pattern like "ERROR" via a metric filter turns it into a metric you can alarm on (prior section). CloudTrail, by contrast, is the audit service recording "who called which API and when," letting you trace resource create/change/delete. Use an organization trail to aggregate all accounts and Regions into one place, store long-term in S3, and enable log file validation for tamper detection. Data events (S3 object operations, Lambda invokes) are off by default—enable them explicitly when needed. To ship EC2/on-prem logs to Logs, use the CloudWatch agent (or the unified agent).

What you wantUse
What the app/OS is doingCloudWatch Logs (Logs Insights)
Who changed/deleted a resourceCloudTrail
Alarm on a word in logsMetric filter + alarm
Audit all accounts/RegionsCloudTrail org trail → S3
Example

Scenario: someone changed a production security group. Identify "who/when/what" via CloudTrail (org trail spans all accounts). Investigate app impact in CloudWatch Logs with Logs Insights for the time window. To prevent recurrence, watch that API with a metric filter + alarm notifying SNS, and wire EventBridge to auto-remediate.

Note

Q. Who deleted it? CloudTrail. Q. Analyze app error logs? CloudWatch Logs (Logs Insights). Q. Record S3 object reads? Enable CloudTrail data events. Q. Detect log tampering? Log file validation.

Warning

Watch the mix-ups: (1) CloudTrail = API audit (who did what) / CloudWatch Logs = app/OS logs (what happened)—don’t swap roles. (2) Data events (S3/Lambda) are off by default. (3) CloudTrail shows management events in Event history for 90 days, but long-term retention needs an S3 trail.

Tip

Storing a CloudTrail trail in S3 long-term and aggregating multi-region/org-wide into one place aids audit and compliance.

1.2.2Section summary

  • CloudWatch Logs = app/OS logs / CloudTrail = API activity audit
  • Alarm on log words = metric filter + alarm

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. You want to investigate "who deleted that resource and when." Which service fits best?

Q2. You want to aggregate app logs and analyze them with a query language. What do you use?

Q3. You want to notify when "ERROR" appears more than N times in logs. What do you use?

Check your understandingPractice questions for Chapter 1: Monitoring, Logging, and Remediation