latest run 54 pass 0 fail 0 skipevidence →
HKB Operations: pages
HKB OperationsKnowledge space

Starred pages

Pages

Page directory · Labels · [ hides this

ADR-0044 accepted

Prod's access logs through CloudFront standard logging v2

  • Status: Accepted
  • Date: 2026-11-01

Context

The live site counted only CloudFront's request metrics, which can't say which pages people read, where they came from or what device they used. Kyle approved access logs for Prod on 2026-10-30, kept for 30 days, without cookies, and readable by the read-only role. CloudFront offers two kinds of logging. The older kind writes to a bucket with ACLs turned on and logs every field. The newer kind (v2) delivers through CloudWatch Logs, keeps ACLs off and logs only the fields chosen. Security Hub's check for logging (CloudFront.5) looks only at the older kind.

Decision

  • Prod uses v2. Sandbox and Dev don't log.
  • The logs go to their own bucket in the Log Archive account, encrypted with their own key, deleted after 30 days, and nobody can delete them sooner.
  • Only twelve fields are kept: date, time, edge location, status, method, path, referrer, user agent, client address, result type, time taken and bytes.
  • The read-only role can read the logs. So can one daily job in Prod, which writes the site's traffic totals and never the addresses (DQ-134).
  • CloudFront.5 stays an accepted finding in Prod, with a new reason: Prod logs through v2, which the check doesn't read.

Consequences

  • The traffic page can count views, visitors, sources and devices from the day logging starts. Earlier days can't be filled in.
  • Addresses stay in Log Archive for 30 days and leave it only in memory, during the daily job.
  • Security Hub keeps reporting CloudFront.5 for Prod, so the accepted-findings list carries it with the v2 reason.
  • The bucket is a hand stack in Log Archive, applied before the site template turns the delivery on.
  • It costs cents a month.

Alternatives considered

  • The older logging. CloudFront.5 would pass, but the bucket would need ACLs on, which raises its own finding, and every field would be logged.
  • Both kinds. All the costs of the older kind, just to pass one check.
LLMs look here
  • Records DQ-132 and DQ-134 (for DQ-250). Amends DQ-43: CloudFront.5 stays accepted in Prod for a new reason.
  • Bucket hkb-site-logs-<log archive account>, key alias alias/hkb-site-logs: security/hkb-log-archive-site-logs.yaml, applied by hand as H-7.15 (log-archive.sh site-logs-plan, then site-logs-exec <cs>). Delivery is limited to Prod's delivery-source ARNs. Reads go to HKB-ReadOnly in Log Archive (S3, and decrypt through S3) and to hkb-site-traffic in Prod.
  • Delivery: SiteLogsSource and SiteLogsDelivery in workloads/hkb-site.yaml, Prod only. The delivery destination hkb-site-logs (JSON output) is in Log Archive with a policy that lets Prod call logs:CreateDelivery; cross-account delivery needs it in the bucket's account (CloudFront developer guide, standard logging v2). The Log Archive account ID comes from the catalog parameter /hkb/aws/account/log_archive/id (DQ-81), resolved by hkb-pipeline-site. hkb-pipeline-cfn-site holds the logs:*Delivery* grants in Prod.
  • Security Hub's CloudFront.5 reads standard logging (legacy) only (AWS Security Hub user guide, CloudFront controls).

Page information

Owner
Platform Engineering
Status
accepted From the decision record.
Generated from
docs/adr/0044-prod-access-logs-through-cloudfront-v2.md
Linked from
Findings review, Decisions