Skip to content

Intermediate · Cloud security basics · topic 31 of 43 · 30 min

Logging and monitoring in the cloud

Explanation

Cloud providers record who did what in your account: AWS CloudTrail, Azure Activity Log and Microsoft Entra sign-in logs, and Google Cloud Audit Logs. Threat detection services such as Amazon GuardDuty and Microsoft Defender for Cloud watch these and alert on suspicious behaviour. Analysts look for root logins, logins without MFA, new access keys, changes to logging, and public exposure.

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

ProviderAudit of actionsSign-insThreat detection
AWSCloudTrail (API calls and console actions)CloudTrail ConsoleLogin eventsAmazon GuardDuty; findings collected in Security Hub
Microsoft AzureAzure Activity LogMicrosoft Entra ID sign-in and audit logsMicrosoft Defender for Cloud; Microsoft Sentinel as SIEM
Google CloudCloud Audit Logs (Admin Activity, Data Access)Cloud Identity / Workspace login auditSecurity 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

json
{
  "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" }
}
A root login without MFA at 08:42 IST (03:12 UTC) from an unknown IP. This should page the on-call analyst immediately. (Simplified; 111122223333 is AWS's example account number.)

Events worth alerting on

Event (AWS name)Why it matters
ConsoleLogin by Root, or with MFAUsed = NoMost powerful identity or weak login
StopLogging, DeleteTrail, UpdateTrailAttackers turn off logging to hide
CreateAccessKey, CreateUser, AttachUserPolicyAttackers create persistence and raise privileges
PutBucketPolicy, PutBucketAcl, DeletePublicAccessBlockData may be made public
AuthorizeSecurityGroupIngress with 0.0.0.0/0A port opened to the world
Many GetObject calls from a new identity or IPPossible data theft
RunInstances in an unused regionPossible 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?

bash
$ aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=StopLogging --max-results 5
{
    "Events": []
}
Searching recent CloudTrail events for StopLogging. Empty is good news.

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

Control-plane attacks

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)

Task 1 · Question

Which AWS service records API calls and console actions in your account?

Task 2 · Code · Python

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"

Task 3 · Practice

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

Question 1

1.Why should cloud audit logs go to a separate logging account?

Question 2

2.Which event most strongly suggests an attacker is hiding?

Question 3

3.Microsoft Entra ID sign-in logs show…

Question 4

4.Instances suddenly start in a region your company never uses. Likely cause?

Question 5

5.Which Amazon service gives managed threat detection on CloudTrail, VPC flow and DNS data?

Read more (free)

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.

From Logging, threat detection and incident response

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.

From Cloud identity and access management

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.

From AWS vs Azure vs Google Cloud: the service map

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

  1. This is the last topic of “Cloud security basics”. The module exam comes next.
  2. Module 7 exam: Cloud security basics · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Governance, risk and compliance. 43 topics left in the course before the final exam.

← Previous: Common cloud misconfigurations