If you use Fastly, the recommended setup is the direct Fastly HTTPS logging integration. It avoids the AWS S3/EventBridge/Lambda path.
Prerequisites
- A Siteline website key
- An existing CloudFront distribution configured to write standard access logs to S3
- AWS CLI v2 configured for the target account
jqandzipinstalled locally- Node.js 18+ and npm
- IAM permissions for
s3,lambda,iam, andevents
CloudFront standard logs are delayed by design. Typical availability is 5-15 minutes after requests occur.
Setup
1
Clone and install
2
Configure environment variables
SITELINE_WEBSITE_KEYLOG_BUCKET_NAMEAWS_REGIONAWS_PROFILE(if using SSO or non-default profile)
3
Build and package Lambda
4
Provision AWS resources
npm run setup:s3npm run setup:lambdanpm run setup:eventbridge
5
Point CloudFront logs to the configured bucket
In your CloudFront distribution settings, enable standard access logs and confirm logs are written to
LOG_BUCKET_NAME.How it works
This integration uses S3 log delivery, EventBridge, and Lambda:- CloudFront writes gzipped log files to S3.
- S3 sends
Object Createdevents to EventBridge. - EventBridge invokes the Lambda processor.
- Lambda downloads and gunzips the log file.
- Lambda parses the
#Fieldsheader dynamically, maps each valid row, and sends events to Siteline.
Configuration
string
required
Your Siteline website key. If missing, the Lambda exits without processing logs.
string
required
S3 bucket used for CloudFront standard logs. Lambda only reads objects from this bucket.
string
required
AWS region used by setup scripts and Lambda operations.
string
Region override for S3 bucket operations. Defaults to
AWS_REGION.string
Siteline intake endpoint. Defaults to
https://api.siteline.ai/v1/intake/pageview.boolean
Enables debug mode in the Siteline SDK.
string
Lambda function name. Default is
siteline-cloudfront-s3-processor.string
EventBridge rule name for S3 object-created events.
Required IAM policies
Lambda trust policy:Troubleshooting
No Lambda invocations
No Lambda invocations
Confirm CloudFront is writing standard logs to
LOG_BUCKET_NAME, then verify S3 EventBridge notifications are enabled on that bucket.No EventBridge to Lambda delivery
No EventBridge to Lambda delivery
Check targets with:
AccessDenied errors during setup or runtime
AccessDenied errors during setup or runtime
Ensure deployer permissions include S3, IAM, Lambda, and EventBridge management. Also confirm Lambda execution role has
s3:GetObject on the log bucket.How do I inspect processor logs?
How do I inspect processor logs?
Stream CloudWatch logs with: