Amazon CloudFront

CloudFront standard logging (v2) delivers access logs across AWS accounts into an S3 bucket managed by EINBLIQ.IO. Send CMCD as a query parameter where possible, because CloudFront standard logs currently do not extract CMCD HTTP headers.

Updated

Values provided by EINBLIQ.IO

Value Used for
<DELIVERY_DESTINATION_ARN> Log delivery destination created by EINBLIQ.IO for your account
<AWS_REGION> Region of the destination bucket

How cross-account delivery works

CloudFront standard logging (v2) sends logs through Amazon CloudWatch Logs delivery. Because the bucket belongs to the EINBLIQ.IO AWS account, both accounts take part:

  1. You send EINBLIQ.IO your AWS account ID and the distribution IDs to include.
  2. EINBLIQ.IO creates a delivery destination for its bucket, allows your account to deliver to it and sends you <DELIVERY_DESTINATION_ARN>.
  3. You create a delivery source for each distribution and connect it to the destination.

AWS sets up cross-account deliveries through the AWS CLI or API rather than the CloudFront console. The CloudWatch Logs delivery APIs for CloudFront run in us-east-1.

Connect your distributions

For each distribution, create a delivery source and a delivery. The exact commands, with your values filled in, are provided during onboarding.

Shell
aws logs put-delivery-source \
  --region us-east-1 \
  --name "einbliq-<DISTRIBUTION_ID>" \
  --resource-arn "arn:aws:cloudfront::<ACCOUNT_ID>:distribution/<DISTRIBUTION_ID>" \
  --log-type ACCESS_LOGS

aws logs create-delivery \
  --region us-east-1 \
  --delivery-source-name "einbliq-<DISTRIBUTION_ID>" \
  --delivery-destination-arn "<DELIVERY_DESTINATION_ARN>"

The log format and fields are set on the EINBLIQ.IO side when the destination is created. CloudFront records the full request URL including the query string (cs-uri-query), whether or not query strings are forwarded to your origin.

Send CMCD as a query parameter

CloudFront standard logs currently do not extract CMCD HTTP headers: apart from fixed fields such as User-Agent and Referer, they contain no request headers, so CMCD sent as CMCD-* headers does not reach the log. Configure your players to send CMCD as a query parameter wherever possible. Support for logging CMCD headers with CloudFront is in development.

Keep CMCD out of the cache key

The managed cache policy CachingOptimized includes no query strings in the cache key, so CMCD does not fragment the cache. If your distribution uses a policy that includes query strings, create a custom cache policy:

Setting Value
Query strings Include all query strings except
Excluded CMCD

Check the delivery

When the deliveries are created, inform EINBLIQ.IO. The delivery check then confirms that log files arrive and contain the CMCD query parameter.