Review CloudFront access logging

Collect CloudFront access logs and verify delivery to retain request history for security analysis and troubleshooting.

Description

distributionConfig.logging controls legacy CloudFront standard logs sent to S3. Standard logging v2 uses a separate configuration.

Potential impact

Missing viewer-request or response records can leave gaps when tracing outages or unusual traffic.

Remediation

For legacy logs, set distributionConfig.logging.enabled to true. Choose an ACL-enabled bucket that allows CloudFront log delivery. Decide whether to record cookies, restrict readers and set retention. Check that test requests appear in S3. To test an alert, use traffic that meets its condition.

Examples

These excerpts use sample.s3.amazonaws.com as the log bucket. Replace it with your bucket’s domain name.

Before

yaml
apiVersion: cloudfront.aws.crossplane.io/v1alpha1
kind: Distribution
spec:
  forProvider:
    distributionConfig:
      enabled: true
      logging:
        enabled: false
        bucket: sample.s3.amazonaws.com

The distribution is enabled, but legacy log delivery is off. Check any other logging configuration in use.

After

yaml
apiVersion: cloudfront.aws.crossplane.io/v1alpha1
kind: Distribution
spec:
  forProvider:
    distributionConfig:
      enabled: true
      logging:
        enabled: true
        bucket: sample.s3.amazonaws.com

Standard logs can arrive late or omit individual requests.

References