Logging & detection - signals and alerts
Cloud detection starts with logs: CloudTrail, VPC flow logs, IAM audit and DNS become correlated signals that feed the SIEM, managed detection and response automation.
What it is
Logging & detection is the piece of detection that lives on signal: audit trails, control plane logs, data plane logs, runtime events, DNS outputs and identity events. The job is to collect all of this in one place, retain it long enough and fire an alert when something out of the pattern appears.
scans configuration; scans workload behavior. Here the question is broader: 'what happened in this account in the last 90 days, and did it happen again just now?'. The answer lives in correlation: an AssumeRole can be legitimate on its own, and criminal when combined with kms:Decrypt five minutes later and a GetObject on a bucket that nobody in that role should open.
What to capture: audit trails
The classic pillar is the control plane log: every API call, signed, with principal ARN, source IP, user agent, request parameters and response elements. On AWS this is CloudTrail; on Azure it is the Activity Log; on GCP it is Cloud Audit Logs. This is the log that answers 'who called what, when, and what was the result'. Without it, the incident becomes guesswork.
By default CloudTrail records management events (create user, delete bucket) in the account trail, and keeps the last 90 days in the console. For real forensics, it is worth creating a multi-region trail that writes to S3 with object lock, and adding a Lake or a SIEM on top for querying and longer retention.
{
"eventVersion": "1.09",
"userIdentity": {
"type": "IAMUser",
"principalId": "AIDAEXAMPLEPRINCIPAL",
"arn": "arn:aws:iam::111122223333:user/alice",
"accountId": "111122223333",
"accessKeyId": "AKIAEXAMPLEACCESSKEY",
"userName": "alice"
},
"eventTime": "2026-10-09T03:17:42Z",
"eventSource": "s3.amazonaws.com",
"eventName": "GetObject",
"awsRegion": "us-east-1",
"sourceIPAddress": "203.0.113.45",
"userAgent": "aws-cli/2.15.0",
"requestParameters": {
"bucketName": "loja-customer-uploads",
"key": "billing/exports/sept-2026.csv"
},
"responseElements": null,
"requestID": "6E3D4B2XAMPLE",
"eventID": "e9c1f0a6-2b1c-4f37-9a4d-3e2b9c0b8c11",
"readOnly": true,
"eventType": "AwsApiCall",
"recipientAccountId": "111122223333"
}Data plane and network logs
CloudTrail does not see everything. It records the API call, not what happened inside it nor the packet that crossed the network. To close the gap, three sources become mandatory.
- Flow Logs: every packet accepted or rejected on the VPC's ENIs. Source, destination, port, decision (ACCEPT/REJECT), bytes counted. When an exfiltration alert fires, this is the first place to confirm the destination.
- S3 data events: reads and writes on specific buckets (not on by default in the trail because they are expensive). For a bucket with or secrets, this is the log that tells who took what.
- EKS / Kubernetes audit: kube-apiserver writes every call to kube-apiserver-audit.log. ingress create, secret read, exec in a pod - everything goes in. Combined with CloudTrail, it shows the complete chain: kubelet makes a call, pod talks to the API, API returns a token, token becomes AssumeRole.
- DNS logs (Route 53 Resolver / Cloudflare): resolver queries are kept. Useful for detecting DGA (domain generation by malware), beaconing and C2 under the firewall's radar.
Centralization and retention
Collecting everything and leaving each account with its own bucket is a recipe for the log to vanish at the first incident. The right design is fan-out: each account writes its log to S3 (or equivalent) with , and an aggregator lake or a corporate SIEM pulls everything for a single query.
Retention is where most teams slip. Management logs need 90 days hot (fast query) and 365 days cold (S3 + Glacier). VPC flow logs, depending on volume, become 30 days hot and 180 days cold. Audit logs that will become legal evidence call for object lock (WORM) to prevent retroactive tampering - without it, an attacker with write access erases their own tracks.
Detection: rules, anomalies and hunting
The detection layer comes in three flavors. Deterministic rules (signatures) fire on a known signature: ConsoleLogin without MFA, root API key in use, CloudTrail disable. ML / anomalies fire on baseline deviation (login from a never-seen region, massive bucket listing by a user who normally lists three). Hunting is the human looking for what nobody thought to write a rule for.
GuardDuty combines the three flavors in a single managed offering: it consumes CloudTrail, VPC Flow Logs and DNS, and sends findings to EventBridge or Security Hub. The typical integration is Detective coming in for investigation (entity graph + timeline), Security Hub aggregating with Prowler/Inspector, and the (Step Functions, Tines, Torq) firing a runbook. The trick is to keep rules out of the SIEM when the SIEM aggregates poorly, and use GuardDuty for the 80% of obvious findings.
Description: "Forwards critical GuardDuty findings to the SOAR queue"
State: ENABLED
EventBusName: default
EventPattern: |
{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"],
"detail": {
"severity": [{ "numeric": [">=", 7] }],
"type": [
"Recon:EC2/PortProbeUnprotectedPort",
"Recon:EC2/PortProbeOpenPort",
"UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration",
"CredentialAccess:IAMUser/AnomalousBehaviors",
"Policy:IAMUser/RootCredentialUsage",
"Persistence:IAMUser/NetworkPermissions",
"PrivilegeEscalation:IAMUser/AdministrativePermissions",
"Exfiltration:S3/MaliciousIPCaller"
]
}
}
Targets:
- Id: SOARIngestTarget
Arn: arn:aws:sqs:us-east-1:111122223333:soar-ingestSIEM integration
The SIEM (OpenSearch, Splunk, Elastic, Datadog Cloud SIEM) is where correlation happens. Each source (CloudTrail, GuardDuty, flow logs, k8s audit, EDR) becomes an indexed stream, with its own parser and canonical fields (time, actor, target, action, result). The SIEM rule crosses sources: new IAM AssumeRole + CloudTrail GetSecretValue + public bucket touched in <5 min = suspicious session.
To reduce cost and noise, two habits pay off. First, storage tiers: hot in the SIEM (30 days), cold in S3 (Iceberg, Parquet) with Athena or OpenSearch Serverless querying on demand. Second, managed detection for what you have no team to maintain: GuardDuty covers 80% of obvious findings, CSPM covers , CWPP covers runtime. The SIEM is left for what is house-specific.
Where it fits in day-to-day work
- account onboarding: multi-region trail on, Lake or Firehose configured, S3 with object lock on the log bucket, and KMS with a dedicated key for the logs
- application deploy: the app emits structured logs (JSON) to stdout or a sidecar; Fluent Bit / Datadog Agent / OpenTelemetry Collector normalizes and ships to the aggregator
- incident response: the first command is 'search for the principal ARN in the attack window' - without an indexed log this becomes grep on text files
- compliance: CIS Foundations, PCI, SOC 2 require an active trail and minimum retention; without an architected log, the auditor fails you before even opening the checklist
Strengths
- total visibility of what happened: an immutable trail answers 'who, when, from where, what' for any API call in the account
- detection by correlation reduces false positives: a rule that crosses signals from three sources has high precision and low noise
- decent forensics: object lock + long retention guarantees that the log from the day of the incident still exists when you open the case six months later
Limitations
- log custody is continuous work: turning a trail off to cut costs or forgetting to validate object lock turns the log into theater
- volume eats budget: VPC Flow Logs on a large account cost on the order of USD per day; without filtering and tiering, the bill wins the conversation
- signature-based detection only catches the known: a new attacker with unmapped TTPs gets past GuardDuty, and the defense falls to manual hunting and the senior analyst's SIEM rule
connections on the map
- Logging & detection - signals and alertsfeeds postureCSPM - cloud posture
- Logging & detection - signals and alertsprovides the trailCWPP - workload protection
- Logging & detection - signals and alertsdocuments decisionsIAM - identity and access
- Logging & detection - signals and alertstriggers the responseCloud incident response
updated on 14/10/2026 · sources to go deeper · report an error
in other domains
- Digital forensics fundamentalsresponsecloud evidence lives in the audit logs
- Evals - quality measured in productionai-agentsobserving in production feeds evaluation
- Edge and application telemetrysecopssame idea of signal, applied to L7 traffic
Unlocks
test what you learned
Loading questions…