Intermediate · Cloud security basics · topic 31 of 43 · 30 min
Logging and monitoring in the cloud
Explanation
Why cloud logs are different
In the cloud, many attacks never touch a server: the attacker logs in to the console or API with stolen credentials and changes settings, copies data or creates new keys. Server logs will not show this. Cloud audit logs, also called control-plane logs, record every management action in the account.
The main log sources
| Provider | Audit of actions | Sign-ins | Threat detection |
|---|---|---|---|
| AWS | CloudTrail (API calls and console actions) | CloudTrail ConsoleLogin events | Amazon GuardDuty; findings collected in Security Hub |
| Microsoft Azure | Azure Activity Log | Microsoft Entra ID sign-in and audit logs | Microsoft Defender for Cloud; Microsoft Sentinel as SIEM |
| Google Cloud | Cloud Audit Logs (Admin Activity, Data Access) | Cloud Identity / Workspace login audit | Security Command Center |
Other useful sources: network flow logs (VPC Flow Logs) showing connections, storage access logs, load balancer and WAF logs, and DNS query logs.
Reading a CloudTrail event
{
"eventTime": "2026-03-14T03:12:45Z",
"eventSource": "signin.amazonaws.com",
"eventName": "ConsoleLogin",
"userIdentity": { "type": "Root", "arn": "arn:aws:iam::111122223333:root" },
"sourceIPAddress": "198.51.100.23",
"responseElements": { "ConsoleLogin": "Success" },
"additionalEventData": { "MFAUsed": "No" }
}Events worth alerting on
| Event (AWS name) | Why it matters |
|---|---|
| ConsoleLogin by Root, or with MFAUsed = No | Most powerful identity or weak login |
| StopLogging, DeleteTrail, UpdateTrail | Attackers turn off logging to hide |
| CreateAccessKey, CreateUser, AttachUserPolicy | Attackers create persistence and raise privileges |
| PutBucketPolicy, PutBucketAcl, DeletePublicAccessBlock | Data may be made public |
| AuthorizeSecurityGroupIngress with 0.0.0.0/0 | A port opened to the world |
| Many GetObject calls from a new identity or IP | Possible data theft |
| RunInstances in an unused region | Possible crypto mining with stolen keys |
Azure and Google have equivalent events with different names; the questions are the same: who did it, from where, with MFA or not, and was it expected?
$ aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=StopLogging --max-results 5
{
"Events": []
}Good practice
- Turn on audit logging for all accounts and all regions, sent to a separate, locked-down logging account that admins of the main account cannot delete.
- Keep logs long enough; in India CERT-In expects 180 days of logs.
- Send cloud logs to the SIEM so they can be correlated with endpoint and network logs.
- Turn on the provider's threat detection service; it is cheap compared with an incident.
- Set billing alerts: a sudden bill spike is sometimes the first sign of stolen keys.
Common mistakes
- Logs stored in the same account an attacker controls, so they can delete them.
- Data access logging (who read which file) left off for sensitive buckets.
- Ignoring time zones: cloud logs are in UTC.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Logging and monitoring in the cloud · 1/7
Many cloud attacks never touch a server. They use stolen logins to change settings.
Prefer a video by a teacher? Find free videos on “AWS CloudTrail GuardDuty Azure activity log cloud security monitoring” on YouTube ↗
In real life: Keys stolen, logging stopped
A SaaS company in Pune gets a GuardDuty finding at 02:00 IST: API calls from an unusual IP using a developer's access key. CloudTrail shows the same key called StopLogging, created a new access key for a new user, and started large instances in a region the company never uses. Because the trail also wrote to a separate logging account, the evidence survived. The team disabled both keys, deleted the new user, terminated the instances, restarted logging, and found the original key in a developer's public code snippet.
Practice (0/3 done)
Which AWS service records API calls and console actions in your account?
Write risky_events(events) where events is a list of simplified CloudTrail dicts with "eventName", "userType" and "mfa" ("Yes" or "No"). Return a list of (index, reason) tuples, in order, using these rules (an event can match more than one, check in this order): - userType "Root" → "root activity" - eventName "ConsoleLogin" and mfa "No" → "login without MFA" - eventName in {"StopLogging", "DeleteTrail"} → "logging tampered" - eventName "CreateAccessKey" → "new access key"
In a free-tier cloud account (or using the provider's documentation), find where to view the last 90 days of account activity (for AWS: CloudTrail Event history). Write down how to find your own last console login and whether it used MFA.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- The shared responsibility modelCloud security basics · same module
- Logging, threat detection and incident responseCloud Computing (AWS, Azure, Google Cloud) · Cloud security and compliance
- AWS vs Azure vs Google Cloud: the service mapCloud Computing (AWS, Azure, Google Cloud) · Google Cloud and comparing the clouds
- Microsoft Entra ID and Azure RBACCloud Computing (AWS, Azure, Google Cloud) · Microsoft Azure essentials
- Monitoring with CloudWatch, CloudTrail and ConfigCloud Computing (AWS, Azure, Google Cloud) · Serverless, monitoring and cost control
- Azure networking, Functions, databases and monitoringCloud Computing (AWS, Azure, Google Cloud) · Microsoft Azure essentials
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
Why should cloud audit logs go to a separate logging account?
Answer: So an attacker who controls the main account cannot delete them
Separation protects evidence.
Which event most strongly suggests an attacker is hiding?
Answer: StopLogging
Turning off audit logging is a classic defence evasion step.
Microsoft Entra ID sign-in logs show…
Answer: Who signed in, when, from where, and whether MFA was used
They are key for spotting account takeover in Microsoft clouds.
Instances suddenly start in a region your company never uses. Likely cause?
Answer: Stolen credentials used for crypto mining
Unused regions are a favourite for attackers running miners.
Which Amazon service gives managed threat detection on CloudTrail, VPC flow and DNS data?
Answer: GuardDuty
GuardDuty analyses these sources and raises findings.
Which is the Microsoft Azure SIEM service?Related
Answer: Microsoft Sentinel
Microsoft Sentinel is Azure's cloud SIEM; Defender for Cloud handles posture and workload protection.
Which Sysmon Event ID records process creation?Related
Answer: 1
Sysmon Event ID 1 is process creation, with command line and hashes.
From Logs and log sources
What does a cloud IAM policy define?Related
Answer: Which actions are allowed or denied on which resources
Policies are the permission rules.
What is the closest Google Cloud equivalent of AWS Lambda?Related
Answer: Cloud Run functions
Cloud Run functions (formerly Cloud Functions) run single functions on events, like Lambda.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- This is the last topic of “Cloud security basics”. The module exam comes next.
- Module 7 exam: Cloud security basics · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
- Then the next module, Governance, risk and compliance. 43 topics left in the course before the final exam.