terraform-aws-cloudfront-access-logs-to-hive-format
A Terraform template that move CloudFront Access Logs to Hive format for Athena.
CloudFormation stack to TerraForm
Use only moveAccessLogs
Keep the prefix and put it in front of the datetime
e.g.
CloudFront logging setting:
S3 bucket: example-bucket
Log prefix: raw/example.com
Inputs:
new_key_prefix: raw/
gz_key_prefix: partitioned-gz/
Result:
source:
s3://example-bucket/raw/example.com/XXXXXXXXXXXXX.1990-01-01-00.XXXXXXXX.gz
destination:
S3: s3://example-bucket/partitioned-gz/example.com/year=1990/month=01/day=01/hour=00/XXXXXXXXXXXXX.1990-01-01-00.XXXXXXXX.gz
No modules.
Name
Description
Type
Default
Required
create_s3_bucket_notification
S3 Buckets only support a single notification configuration. ref.aws_s3_bucket_notification
bool
false
no
lambda_function_log_retention_in_days
Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0(never)
number
30
no
lambda_function_runtime
Identifier of the function's runtime.
string
"nodejs16.x"
no
lambda_function_timeout
Amount of time your Lambda Function has to run in seconds.
number
30
no
name_prefix
Prefix that is used for the created resources. If specified, it will be '{name_prefix}-{name_suffix}'
string
""
no
name_suffix
Suffix that is used for the created resources.
string
"move-cf-access-logs"
no
s3_bucket_gz_key_prefix
Prefix of gzip'ed access log files that are moved to the Apache Hive like style. Including the trailing slash
string
"partitioned-gz/"
no
s3_bucket_name
Bucket Name of access log files that are written by Amazon CloudFront
string
n/a
yes
s3_bucket_new_key_prefix
Prefix of new access log files that are written by Amazon CloudFront. Including the trailing slash.
string
"raw/"
no
Name
Description
function_arn
The ARN of the Lambda Function