AWS CloudFront is a content distribution service offered by AWS to speed up the distribution of static content, such as media files, html, js, css, etc. CloudFront provides the log file option to log the end user access request data, its status and other relevant information. The log file will be stored in the S3 bucket. The log file can be in the same bucket as the distribution origin or it can also be in a separate bucket. The user can configure the same bucket for multiple distributions. The user can specify the prefix to the log file to distinguish the distribution details. The CloudFront stores the data to the log file periodically. Each log record will have the user access details, such as the date, time, the edge location information which served the content, the bytes from the server to the client, the client IP, the protocol (HTTP/s), the query string, and more.
The user account where the CloudFront distribution is located should have full access to the S3 bucket. If the bucket belongs to some other AWS account, provide the access rights.
The present guide demonstrates how to enable logging for the CloudFront download or the streaming distribution.