This AWS CDK construct modifies the storage format of CloudFront logs in S3 to make them easier to query with Athena and Glue. By enabling event notifications to EventBridge for logs generated by CloudFront, it detects their creation and uses a Step Functions state machine to copy them to a specified S3 bucket (with a specified prefix) while also providing functionality to delete the original files.
npm install @gammarers/aws-cloudfront-access-log-relocater
yarn add @gammarers/aws-cloudfront-access-log-relocater
import { CloudFrontAccessLogRelocater } from '@gammarers/aws-cloudfront-access-log-relocater';
declare const logBucket: s3.Bucket;
new CloudFrontAccessLogRelocater(stack, 'CloudFrontAccessLogRelocater', {
accessLogSource: {
bucket: logBucket,
objectPrefix: 'origin-logs',
},
accessLogDestination: {
bucket: logBucket,
objectPrefix: 'partitioning-log',
},
});
This project is licensed under the Apache-2.0 License.