SaveMyCert
Log in
5 of 5 free questions left today·for unlimited practice
Detection

Designing Security Logging Solutions: CloudTrail, Flow Logs, Central Archives

17 min readSCS-C03 · DetectionUpdated

A security logging solution on AWS answers three questions by design: which sources capture the events that matter, where those logs are delivered and centralized, and how the archive is protected, retained, and queried. SCS-C03 Task 1.2 tests all three. You need CloudTrail at depth — management versus data events, organization trails, log file integrity validation — plus the network sources (VPC Flow Logs, transit gateway flow logs, Route 53 Resolver query logs) and the service logs from ELB, CloudFront, AWS WAF, Amazon EKS, and RDS. On the delivery side, the exam expects the central logging account pattern: S3 as the durable archive with service-delivery bucket policies, SSE-KMS with the key-policy implications, Object Lock for tamper-evidence, CloudWatch Logs where streaming and interactive queries matter, subscription filters into Kinesis or Firehose for SIEM feeds, and Amazon Security Lake as the managed OCSF alternative. This lesson builds that design source by source, then walks through a tamper-evident organization-wide archive.

What you’ll learn
  • Select the right log source for a requirement, knowing exactly what each source captures and what it omits.
  • Design an organization CloudTrail trail with management and data events scoped deliberately, and validate log integrity with digest files.
  • Centralize logs into a dedicated logging account using S3, CloudWatch Logs, and subscription filters into Kinesis or Firehose.
  • Protect log archives with service-delivery bucket policies, SSE-KMS, deny-delete statements, and S3 Object Lock.
  • Design retention and lifecycle for compliance, and choose between Athena and CloudWatch Logs Insights at investigation time.

The security log inventory: what each source captures

Every logging design starts from the same inventory: know what each source records, where it can deliver, and — just as important on the exam — what it does not capture.

SourceWhat it capturesDelivery destinations
CloudTrail management eventsControl-plane API calls: who did what, from where, whenS3, CloudWatch Logs, CloudTrail Lake
CloudTrail data eventsHigh-volume data-plane operations: S3 object-level access, Lambda invocations, DynamoDB item activityS3, CloudWatch Logs, CloudTrail Lake
VPC Flow LogsIP traffic metadata per ENI: addresses, ports, protocol, bytes, ACCEPT/REJECT — never payloadsS3, CloudWatch Logs, Firehose
Transit gateway flow logsTraffic metadata crossing a transit gateway between VPCs and hybrid attachmentsS3, CloudWatch Logs, Firehose
Route 53 Resolver query logsDNS queries from VPC resources and the responses they receivedS3, CloudWatch Logs, Firehose
ELB access logsPer-request client IP, latency, backend response, TLS detailsS3 only
CloudFront logsViewer requests at the edge (standard logs; real-time logs stream to Kinesis)S3; Kinesis Data Streams (real-time)
AWS WAF logsInspected web requests with matched rules and the action takenCloudWatch Logs, S3, Firehose
EKS control plane logsAPI server, audit, authenticator, controller manager, scheduler logsCloudWatch Logs
RDS logsDatabase engine logs: error, audit, slow query (engine-dependent)CloudWatch Logs export

Map requirement language to a row: “who deleted the bucket” is CloudTrail management events; “which object was read” is S3 data events; “was the connection rejected” is flow logs; “which domain did the instance resolve” is Resolver query logs.

CloudTrail: management events, data events, and organization trails

CloudTrail is the control-plane record and the backbone of every AWS investigation. Management events capture control-plane operations — RunInstances, PutBucketPolicy, AssumeRole, console sign-ins — and a trail records them by default. Data events capture data-plane operations — GetObject and PutObject on S3, Lambda Invoke, DynamoDB item-level actions — and are off by default because volume and cost are dramatically higher. Enable them selectively, scoped with selectors to the sensitive buckets or functions that justify the volume; advanced event selectors give fine-grained matching on fields like resource ARN. A design that enables all data events everywhere is usually the distractor.

Make trails multi-Region — the default when creating a trail in the console — so activity in a Region you never use (a favorite attacker hiding spot) is still recorded, including global service events like IAM calls.

At organization scale, use an organization trail: created from the management account (or a CloudTrail delegated administrator account), it automatically logs every existing and future member account to one central S3 bucket. Member accounts can see the trail but cannot modify, stop, or delete it — the property that makes it the answer whenever a scenario requires logging that individual account administrators cannot tamper with or opt out of. Delivery to S3 typically lands within about 15 minutes of the API call, which is why CloudTrail is an audit and investigation source, not a real-time alerting mechanism on its own — pair it with CloudWatch Logs delivery and metric filters when latency matters.

Network log sources: flow logs and DNS visibility

Network telemetry answers the questions CloudTrail cannot: what actually moved, between which addresses, and was it allowed. VPC Flow Logs record IP traffic metadata at the VPC, subnet, or ENI level. Each record carries the source and destination addresses and ports, protocol, byte and packet counts, and the action — ACCEPT or REJECT — telling you whether security groups or network ACLs permitted the flow. The default format is only the beginning: custom formats add fields that matter in security work, such as pkt-srcaddr and pkt-dstaddr (the original addresses behind a NAT gateway, without which you attribute traffic to the NAT rather than the real source), tcp-flags (SYN scans stand out), flow-direction, and traffic-path.

Know the limitations cold: flow logs capture metadata only, never packet payloads; they are not real time; and certain traffic is excluded, including traffic to the Amazon DNS resolver, instance metadata requests to 169.254.169.254, and DHCP. Transit gateway flow logs fill a related gap, recording flows crossing a transit gateway — the vantage point for inter-VPC and hybrid traffic that a single VPC's logs cannot show end to end.

DNS is its own detection channel. Route 53 Resolver query logging records the domains VPC resources look up and the responses returned — often the earliest indicator of malware calling home. Note the division of labor: GuardDuty already analyzes DNS query activity directly from AWS infrastructure whether or not you enable Resolver query logging; you enable query logging when you need the records — for your SIEM, for Athena hunts, or for retention.

Edge, application, and platform logs

Above the network layer, each tier contributes its own record. ELB access logs capture every request a load balancer handles — client IP, request line, latencies, backend status, and TLS cipher and protocol version, which matters when auditing for legacy TLS clients. They deliver to S3 only, and a detail worth remembering: the ALB access-log bucket must use SSE-S3 encryption, as SSE-KMS is not supported for that delivery path. CloudFront standard access logs record viewer requests at the edge into S3, while real-time logs stream selected fields to Kinesis Data Streams when seconds matter. AWS WAF logs record each inspected request, the rules it matched, and the action taken (allow, block, count) — the evidence base for tuning rules and investigating application-layer attacks; they deliver to CloudWatch Logs, S3, or Firehose, with the log group or bucket name required to begin with aws-waf-logs-.

Amazon EKS control-plane logging sends five log types to CloudWatch Logs — API server, audit, authenticator, controller manager, and scheduler. The audit log is the security-critical one: it records who did what against the Kubernetes API, the cluster-level equivalent of CloudTrail. Each type is enabled individually on the cluster.

RDS engine logs — error, audit, and slow-query logs, varying by engine — export to CloudWatch Logs for retention and search, and operating-system-level logs from EC2 instances reach CloudWatch Logs through the CloudWatch agent, which you configure to ship security-relevant files such as /var/log/secure. For the exam, know these exist and where they land; deep tuning belongs to the database and compute domains.

Centralizing delivery: the logging account pattern

Centralization is the structural defense: logs that leave the account they were generated in cannot be destroyed by compromising that account. The standard design is a dedicated log archive account in the organization holding the S3 buckets that receive the organization trail, flow logs, and service logs, plus — where streaming is needed — a dedicated CloudWatch logging account receiving cross-account log flows. Producers write in; almost nobody reads; security tooling consumes through tightly scoped roles.

Choose the destination per log by how it will be used. S3 is the durable archive: cheapest at rest, lifecycle-managed, queryable in place with Athena — the default for anything kept for compliance. CloudWatch Logs is the operational store: near-real-time ingestion, metric filters that turn patterns into alarms, Logs Insights for interactive queries, and per-group retention settings. Many sources justifiably go to both — CloudTrail to S3 for the archive and to CloudWatch Logs for alerting.

To move logs onward, subscription filters stream matching events from a log group to Kinesis Data Streams, Amazon Data Firehose, or Lambda. The classic SIEM feed is a subscription filter into Firehose, which batches, optionally transforms via Lambda, and delivers to S3, OpenSearch Service, or an HTTP endpoint such as Splunk. Cross-account streaming works through a CloudWatch Logs destination resource in the receiving account, fronting its stream with a resource policy that permits sender accounts.

Amazon Security Lake is the managed alternative to building this pipeline yourself: it collects CloudTrail, flow logs, Resolver logs, EKS audit logs and more org-wide, normalizes them to OCSF in Parquet, and hands SIEMs the data through subscribers. Weigh it whenever the requirement is multi-source, multi-account normalization rather than a single feed.

Protecting the archive: bucket policies, encryption, and tamper-evidence

A log archive is a target — an attacker covering tracks attacks the logs first — so the exam tests its protection in detail. Start with the service-delivery bucket policy: CloudTrail delivery requires statements allowing the cloudtrail.amazonaws.com service principal s3:GetBucketAcl on the bucket and s3:PutObject on the delivery prefix, conditioned on s3:x-amz-acl being bucket-owner-full-control. Harden delivery policies with aws:SourceArn or aws:SourceAccount conditions so only your trail can write — the mitigation for confused-deputy delivery from someone else's account.

Encrypt with SSE-KMS and understand the key-policy consequences, a repeat exam scenario: the key policy must allow CloudTrail to call kms:GenerateDataKey (scoped with an encryption-context condition on the trail), or delivery fails silently from the bucket's perspective; and analysts need kms:Decrypt or Athena queries return access errors even with full S3 read. The customer managed key should live in the log archive account, administered separately from log readers.

Enforce least privilege and deny-delete: an explicit bucket-policy Deny on s3:DeleteObject (and denying s3:PutBucketPolicy except for a break-glass role) means even a compromised administrator in the log account cannot purge evidence. Versioning preserves prior versions against overwrite. For true write-once-read-many, S3 Object Lock in compliance mode makes objects undeletable and unmodifiable for the retention period by anyone, including the root user — governance mode, bypassable with s3:BypassGovernanceRetention, is the weaker cousin. Object Lock requires versioning.

Finally, CloudTrail log file integrity validation proves the record itself: hourly digest files containing SHA-256 hashes of each delivered log file, signed by CloudTrail, chained so each digest references its predecessor. Running validate-logs detects any modified, deleted, or forged log file — the answer to “prove the logs weren't altered.”

Retention, lifecycle, and querying the archive

Retention is a compliance decision implemented as lifecycle automation. In S3, lifecycle rules transition aging log objects to cheaper storage classes — Glacier Flexible Retrieval or Glacier Deep Archive for logs kept for multi-year mandates — and expire them when the retention period ends. Design the transition points around access patterns: recent logs get queried during investigations and belong in Standard or Intelligent-Tiering; year-old logs are almost never read and can tolerate retrieval delays. When Object Lock enforces retention, align the lock period with the lifecycle expiration so expiry doesn't silently fail against locked objects. In CloudWatch Logs, retention is per log group and defaults to never expire — an unbounded cost and data-minimization problem, so set explicit retention on every group, keeping the durable copy in S3.

Querying splits by where the logs live. Amazon Athena runs SQL directly over CloudTrail, flow logs, and ELB logs in S3 — define the table once and query years of history in place; partitioning (or partition projection) by date and Region keeps queries from scanning the whole archive. It is the tool for broad, historical questions: every action by an access key over six months, every source address that reached a port across the fleet. CloudWatch Logs Insights runs a purpose-built query language interactively over log groups — the tool for fast, recent, operational investigation where the data already streams to CloudWatch Logs. The selection rule the exam rewards: Athena for deep history in S3, Logs Insights for recent data in CloudWatch Logs; and when the requirement outgrows both into multi-source normalized analytics, that is Security Lake with Athena over OCSF tables.

Scenario: a tamper-evident central log archive for an organization

A regulated company with 30 accounts must retain security logs for seven years, prove logs were never altered, guarantee no single account administrator can destroy them, and feed its SIEM in near real time. The design:

  1. Centralize with an organization trail. From the management account, create a multi-Region organization trail with log file integrity validation enabled, delivering to a bucket in the dedicated log archive account. Every member account, present and future, is logged; members cannot stop or alter the trail.
  2. Scope data events deliberately. Add advanced event selectors for S3 data events on the buckets holding regulated data — not on every bucket.
  3. Add the network and service sources. Organization-wide VPC Flow Logs with a custom format including pkt-srcaddr and tcp-flags, Route 53 Resolver query logging, and WAF and ELB access logs, all delivering into the archive account.
  4. Harden the buckets. Service-delivery policies conditioned on aws:SourceArn; SSE-KMS with a key in the archive account whose policy grants CloudTrail kms:GenerateDataKey and analysts kms:Decrypt; versioning plus Object Lock in compliance mode with seven-year retention; an explicit deny on s3:DeleteObject.
  5. Lifecycle for cost. Transition objects to Glacier Deep Archive after 90 days; expire after seven years, aligned with the lock period.
  6. Stream to the SIEM. Send CloudTrail to CloudWatch Logs in parallel and attach a subscription filter into Firehose delivering to the SIEM endpoint.

An auditor asking “prove these logs are complete and unmodified” gets a validate-logs run over the digest chain; an attacker who owns a member account finds nothing there to delete.

Tip. Trigger phrases decide these questions: “prove the logs weren't modified” means CloudTrail log file integrity validation and digest files; “one trail covering every current and future account that member admins can't disable” means an organization trail; “regulator requires logs to be undeletable” means S3 Object Lock in compliance mode on the archive bucket; “normalize security data to OCSF” or “managed security data lake” means Security Lake. Expect troubleshooting-flavored design questions on SSE-KMS log buckets — delivery failing because the key policy lacks GenerateDataKey for the service, or analysts unable to read logs without kms:Decrypt. Also watch the query-tool split: Athena for SQL over years of logs in S3, CloudWatch Logs Insights for recent data already in log groups.

Key takeaways
  • An organization trail from the management account logs every member automatically, and member accounts cannot modify, stop, or delete it — the answer to tamper-resistant org-wide logging.
  • Management events record the control plane and are on by default; data events (S3 objects, Lambda invokes) are high-volume, off by default, and should be scoped with event selectors.
  • CloudTrail log file integrity validation — hourly SHA-256 digest files, signed and chained — is how you prove logs were not modified or deleted.
  • VPC Flow Logs capture metadata only, never payloads; custom-format fields like pkt-srcaddr and tcp-flags are what make them useful behind NAT and against scans.
  • Centralize into a dedicated log archive account: service-delivery bucket policies with source conditions, SSE-KMS (key policy must grant the logging service GenerateDataKey and readers Decrypt), versioning, deny-delete, and Object Lock compliance mode for WORM.
  • S3 is the durable, Athena-queryable archive; CloudWatch Logs is the operational store with metric filters and Logs Insights; subscription filters into Kinesis or Firehose are the SIEM bridge.
  • Security Lake is the managed alternative to a hand-built pipeline: org-wide collection normalized to OCSF Parquet, consumed by SIEMs through subscribers.
  • Set lifecycle transitions and explicit retention everywhere — CloudWatch Logs groups default to never expiring.

Frequently asked questions

How do I prove CloudTrail logs have not been modified or deleted?

Enable log file integrity validation on the trail. CloudTrail then delivers hourly digest files containing SHA-256 hashes of every log file, signs each digest, and chains digests so each references its predecessor. Running the CLI validate-logs command over a time range verifies the chain and reports any log file that was modified, deleted, or forged since delivery. Pair it with Object Lock and deny-delete bucket policies so tampering is prevented as well as detectable.

Should security logs go to CloudWatch Logs or to S3?

Both, for different jobs. S3 is the durable archive: cheapest for long retention, lifecycle-managed into Glacier tiers, and queryable in place with Athena. CloudWatch Logs is operational: near-real-time ingestion, metric filters that drive alarms, and Logs Insights for interactive queries. A common CloudTrail design delivers to S3 for the compliance archive and to CloudWatch Logs for alerting on patterns like console sign-in failures.

Do VPC Flow Logs capture the contents of network traffic?

No. Flow logs record metadata only — addresses, ports, protocol, byte and packet counts, and whether the flow was accepted or rejected — never packet payloads. They also exclude certain traffic, including queries to the Amazon DNS resolver and instance metadata requests. If a requirement demands payload inspection, flow logs are the distractor; that is traffic mirroring or an inline inspection appliance, not a logging feature.

What is the difference between an organization trail and creating a trail in each account?

An organization trail is created once from the management account (or a CloudTrail delegated administrator) and automatically applies to every existing and future member account, delivering all logs to one central bucket. Member accounts can view it but cannot modify, stop, or delete it. Per-account trails require per-account setup, drift over time, miss newly created accounts, and can be disabled by the account's own administrators — exactly what an attacker in that account would do.

Why does GuardDuty detect DNS-based threats even though I never enabled Route 53 Resolver query logging?

GuardDuty consumes DNS query activity, CloudTrail management events, and VPC Flow Logs directly from AWS infrastructure, independently of whether you enabled those logs yourself. Enabling Resolver query logging is for your own visibility — feeding your SIEM, running Athena hunts over resolved domains, or meeting retention requirements — not a prerequisite for GuardDuty's DNS findings.

When should I use Amazon Security Lake instead of building my own log pipeline?

Choose Security Lake when the requirement is centralizing many security sources across an organization into one normalized, queryable store — it collects CloudTrail, VPC Flow Logs, Resolver query logs, EKS audit logs, and Security Hub findings across accounts and Regions, normalizes everything to OCSF in Parquet on S3, manages retention, and exposes the data to SIEMs and analytics through subscribers. Build a custom pipeline with subscription filters and Firehose when you need one specific feed, custom transformation, or a destination Security Lake does not serve.

Test yourself on this topic
Practice questions with full explanations.
Practice now

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.