Security Monitoring
Logging and monitoring for security - how to track activities in your systems, detect threats, and respond to security incidents.

Why Do We Need Security Monitoring?
What is security monitoring and logging? Security monitoring and logging is the continuous recording of events in systems and their evaluation to detect attacks. Logging stores an audit trail: who did what, when and from where. Monitoring watches those records in near real time and, on suspicious activity such as a root user sign-in or a permission change, raises an alarm for the team.
Even with the strongest security measures, we must be prepared for situations where an attack is attempted or actually carried out. Logging is like security cameras in your building - they record what happens. Monitoring is the alarm system - it alerts you when something suspicious occurs. Without these tools, you won't know that someone stole your credentials until it's too late.
Physical Security Analogy
Imagine a luxury villa with valuable items inside. You have high walls, locked doors, and a safe for the most precious belongings. But what if someone still manages to get inside?
- Cameras (Logging): Record everything that happens - who arrived, what they did, where they went
- Alarm (Monitoring): Immediately alerts when someone enters a secured area
- Security Service (Incident Response): The team that responds to alarms
Security is Layered
We protect the system at every level of attack - before, during, and after an attack. Monitoring and logging are key to detection and response during and after an attack.
AWS Monitoring & Logging Services
AWS CloudTrail
Auditing of API calls and other activity in your AWS account.
- Management events by default
- Who, what, when, from where
- Data and network activity events optional (charged)
- Event history: last 90 days of management events
- Multi-region trails
- Log file integrity validation
AWS CloudWatch
Monitoring and management service for metrics, logs, and alarms.
- Metrics from AWS services
- Custom metrics
- Log groups and log streams
- Alarms and notifications
- Dashboards
AWS GuardDuty
Threat detection using threat intelligence and machine learning models over CloudTrail management events, VPC Flow Logs and DNS logs (AWS).
- Anomaly detection
- Extended Threat Detection (multi-stage attacks)
- Threat intelligence feeds
- Automated findings
- Integration with Security Hub
AWS Security Hub and Security Hub CSPM
With the launch of the new Security Hub (preview June 2025, GA December 2025), the original service was renamed Security Hub CSPM. The new Security Hub correlates findings from CSPM, GuardDuty, Inspector and Macie in OCSF format.
- Findings aggregation and correlation
- Compliance checks (CSPM: CIS, NIST, PCI DSS)
- Exposure findings and attack path graph
- Automated response and ticketing (Jira, ServiceNow)
CloudTrail - Basic Configuration
By default a trail records management events: every console sign-in, instance creation and security group change. Data events (for example S3 object reads) must be enabled separately and are charged. An event typically appears in the log within 5 minutes of the API call. The arguments in the example match the Terraform provider documentation; the bucket policy and the KMS key policy are omitted for brevity.
CloudWatch Alarms for Security Events
Example: Failed Login Alarm
Other Important Alarms
The filters follow the CIS AWS Foundations Benchmark (v1.2.0 and v1.4.0), whose recommendations Security Hub CSPM checks as CloudWatch.1 to CloudWatch.14.
What to Monitor?
Key Security Events
Authentication & Authorization
- Failed login attempts (brute force detection)
- Root account usage
- MFA disabled
- New IAM users/roles created
- Permission changes
Network & Infrastructure
- Security group changes
- VPC changes
- Route table modifications
- Network ACL changes
- New EC2 instances
Data Access
- S3 bucket policy changes
- S3 public access
- KMS key deletion/disable
- RDS snapshot sharing
- Secrets Manager access
Billing & Account
- CloudTrail disabled
- Config rules changes
- Unusual billing spikes (cryptomining)
- Account settings changes
Security Monitoring Best Practices
Logging
- Enable CloudTrail in all regions
- Retain logs for at least 1 year (the default of control CloudWatch.16 is 365 days)
- Encrypt logs at rest (SSE-KMS, otherwise CloudTrail uses SSE-S3)
- Enable log file integrity validation (SHA-256, signed digest files)
- VPC Flow Logs for network traffic
- Centralize logs into a single account (Security Account)
Monitoring & Alerting
- Alarms on critical security events
- Near real-time notifications (SNS, Slack, PagerDuty)
- Dashboards for the security team
- GuardDuty for threat detection
- Security Hub for centralized overview, Security Hub CSPM for compliance checks
- Regular review of findings
Incident Response
- Defined playbooks for different types of incidents
- Automated remediation where possible
- Regular incident response drills
- Post-incident reviews
- Documentation of all incidents
What NOT to Do
- Disable CloudTrail (even temporarily)
- Ignore alarms (alert fatigue)
- Delete logs before the retention period ends
- Make logs accessible to everyone (least privilege)
- Forget to monitor production
- Not have an incident response plan
Sources
- AWS: CloudTrail concepts (October 2026)
- AWS: AWS CloudTrail FAQs (October 2026)
- AWS: Validating CloudTrail log file integrity (October 2026)
- AWS: Encrypting CloudTrail log files with AWS KMS keys (October 2026)
- AWS: Security Hub CSPM controls for Amazon CloudWatch (October 2026)
- AWS: Introduction to AWS Security Hub (October 2026)
- AWS: Security Hub document history (October 2026)
- AWS: What is Amazon GuardDuty? (October 2026)
- AWS: Logging IP traffic using VPC Flow Logs (October 2026)
- HashiCorp: Terraform AWS provider, aws_cloudtrail resource (October 2026)