Study Guide: Correlating and Analyzing AWS Log Sources
Correlating and analyzing information across single or multiple AWS log sources
Correlating and Analyzing Information Across AWS Log Sources
Effective network monitoring in complex AWS environments requires the ability to stitch together disparate data points from multiple services to reconstruct events, identify security threats, and optimize performance.
Learning Objectives
After studying this guide, you should be able to:
- Describe the general workflow for centralizing log data from multiple sources.
- Identify the specific AWS tools used for advanced querying and log analysis.
- Explain the importance of a common log data structure for event correlation.
- Evaluate different visualization tools for displaying log trends and anomalies.
Key Terms & Glossary
- Log Correlation: The process of linking events from different sources (e.g., CloudTrail and VPC Flow Logs) based on shared attributes like timestamps or IP addresses. Example: Matching an API call in CloudTrail to a specific traffic flow in VPC Flow Logs.
- Centralization: Moving logs from various accounts and services into a single repository to facilitate cross-source searching. Example: Sending logs from 10 different VPCs into a single Amazon OpenSearch cluster.
- Log Insights: Specialized query tools within AWS that allow for fast, interactive searching of log data without needing to manage infrastructure. Example: Using CloudWatch Logs Insights to find the top 10 IP addresses with the most 'REJECT' actions.
- Normalization: Converting log data into a standard format (e.g., JSON) with consistent fields to make comparisons possible. Example: Ensuring all logs use ISO 8601 timestamp formats.
The "Big Idea"
The "Big Idea" is Visibility through Integration. In a distributed cloud environment, a single log source provides only a partial view. To truly understand the "who, what, when, and how" of a network event, you must aggregate logs from different layers—Identity (CloudTrail), Network (VPC Flow Logs), and Application (Load Balancer Access Logs)—into a unified analytical plane.
Formula / Concept Box
The Log Analysis Workflow
| Phase | Action | Purpose |
|---|---|---|
| 1. Collection | Identify sources (ALB, VPC, Route 53) | Gather raw data points |
| 2. Centralization | Use Kinesis, S3, or CloudWatch | Create a single source of truth |
| 3. Standardization | Define common fields (Time, IP, Method) | Enable cross-source correlation |
| 4. Analysis | Run queries (SQL, OpenSearch Query DSL) | Extract insights and identify trends |
| 5. Visualization | QuickSight, Kibana, Dashboards | Make data understandable for stakeholders |
Hierarchical Outline
- I. Centralizing Log Data
- Consolidation Points: Using CloudWatch Logs, Amazon S3, or Amazon OpenSearch.
- Benefit: Simplifies searching across multiple accounts and regions.
- II. Log Data Structure and Normalization
- Standard Fields: Must include timestamps, source IPs, and action methods.
- Common Formats: JSON is preferred for its readability and ease of parsing by tools like Athena.
- III. AWS Analysis Tools
- CloudWatch Logs Insights: Advanced query language for logs stored in CloudWatch.
- Amazon Athena: Serverless SQL queries against logs stored in Amazon S3.
- Amazon OpenSearch: Real-time indexing and search for high-volume logs.
- CloudTrail Insights: Automated detection of unusual API activity.
- IV. Machine Learning & Advanced Analytics
- SageMaker: Identifying complex patterns/anomalies in large datasets.
- Kinesis Data Analytics: Processing and analyzing data streams in real-time.
- V. Visualization
- Kibana: The visual layer for OpenSearch.
- Amazon QuickSight: Business intelligence tool for creating dashboards from S3 or Athena data.
Visual Anchors
Log Pipeline Flow
Geometric Representation of Data Normalization
\begin{tikzpicture} \draw[thick, fill=blue!10] (0,0) rectangle (3,2); \node at (1.5, 1.5) {\textbf{Log Source A}}; \node at (1.5, 0.5) {Timestamp: 12:00};
\draw[thick, fill=red!10] (5,0) rectangle (8,2);
\node at (6.5, 1.5) {\textbf{Log Source B}};
\node at (6.5, 0.5) {Time: 1200 hrs};
\draw[->, ultra thick] (3.5, 1) -- (4.5, 1) node[midway, above] {\small{Normalize}};
\draw[thick, fill=green!10] (2,-3) rectangle (6,-1);
\node at (4, -2) {\textbf{Common Schema}: \textit{iso_timestamp}};\end{tikzpicture}
Definition-Example Pairs
- Event Correlation: Linking a login attempt to a subsequent file deletion. Example: A user logs in (CloudTrail) and then a specific file is accessed in S3 (S3 Access Logs) using the same IAM credentials within a 5-minute window.
- Anomaly Detection: Using baseline data to find outliers. Example: A VPC Flow Log shows a sudden spike in outbound traffic to an unknown IP that doesn't match the historical 30-day average usage pattern.
- Query Language: A specific syntax used to retrieve data. Example: Using
filter @message like /ERROR/in CloudWatch Logs Insights to find specific application failures.
Worked Examples
Scenario: Investigating a Security Breach
Problem: An administrator notices unauthorized configuration changes to a Security Group. They need to find who did it and what network traffic resulted from it.
Step-by-Step Breakdown:
- Identify the "Who": Query AWS CloudTrail for
ModifySecurityGroupRulesevents to find the IAM User and the Source IP address of the requester. - Identify the "Where": Use the Source IP from CloudTrail to query VPC Flow Logs for any traffic originating from that IP address to internal resources.
- Correlate: Match the timestamps from the CloudTrail event with the start/end times in the Flow Logs.
- Result: The admin discovers the breach was caused by a compromised developer credential (found in CloudTrail) that was used to open port 22 and then RDP into a database server (found in VPC Flow Logs).
Comparison Tables
| Tool | Best Use Case | Primary Data Store | Query Method |
|---|---|---|---|
| CloudWatch Logs Insights | Fast, interactive ad-hoc queries | CloudWatch Logs | Specialized query syntax |
| Amazon Athena | Large-scale analysis of historical data | Amazon S3 | Standard SQL |
| Amazon OpenSearch | Real-time search and visualization | OpenSearch Index | Query DSL / Kibana |
| CloudTrail Insights | Automated anomaly detection | CloudTrail | No manual query (Automated) |
Checkpoint Questions
- What is the first general step in correlating information across multiple AWS log sources?
- Which AWS service is best suited for running SQL queries against log data stored in an S3 bucket?
- Why is defining a common log data structure (normalization) critical for analysis?
- Which visualization tool is typically paired with Amazon OpenSearch Service?
- Name two machine learning services AWS provides for identifying anomalies in log data.
Muddy Points & Cross-Refs
- Muddy Point: Users often confuse CloudWatch Logs with CloudTrail. Remember: CloudTrail is "Who did what (API calls)," while CloudWatch is "Performance and application logs."
- Deeper Study: For more on automating responses to these logs, see the AWS Lambda documentation on log triggers.
- Refinement: Always review your retention policies. Long-term storage in S3 is much cheaper than keeping logs in CloudWatch indefinitely.