Unable to get Cloudfront logs for Last 6 months

0

We are trying to get the access log for last 6 months for the objects that are getting served through CloudFront. Requests per object under reports and analytics are available but those are only for last 2 months. We can see the requests for last 6 months in the Distribution metrics of CloudFront but when we try to 'view logs', page gets redirected to CloudWatch log groups where I can't see any group for CloudFront. Attached Screenshot

If we are able to see requests for last 6 months that indicates logs are available for the same. From where we can get those log files? Please help us to get those logs for last 6 months.

Thanks in Advance for the help!

1 Answer
0

CloudFront access logs are stored in Amazon S3 and can be used to see the requests for your CloudFront distributions for the last six months. Here are the steps you can take to access the logs for the last 6 months:

In the AWS Management Console, navigate to the CloudFront service. In the left-hand navigation, click on "Distributions". Select the distribution for which you want to view the logs. In the General tab, under the "Logs" section, click on the "Enable" button. A dialog box will appear asking you to specify an S3 bucket to store the logs. If you don't have an existing S3 bucket, you can create a new one. Once you have specified the S3 bucket, click on "Create" to enable logging. Once logging is enabled, CloudFront will start logging all requests to the specified S3 bucket. The logs will be stored in a directory structure in the S3 bucket, with the top-level directory being the distribution ID, and subdirectories for each day. The logs will contain information such as the request time, the IP address of the client, the request URI, and the HTTP status code.

You can use the S3 bucket's access logs to see the requests for your CloudFront distributions for the last 6 months. You can also use Amazon Athena, Amazon QuickSight, or AWS Glue to analyze the logs.

Please note that, CloudFront logs are delivered to your S3 bucket every 12 hours, so you might not see the latest access logs immediately.

Also, there's a retention period for the logs on the S3 bucket, make sure the logs are still available within that retention period.

profile picture
answered a year ago
  • Hi Ahmad,

    Thank you for the reply! After implementing the configuration you have mentioned we will start getting the logs for Cloudfront distribution in the next 12 hours. But as mentioned in the description we are concerned about logs for the past 6 months which are from July 2022 to December 2022, How can we access those logs?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions