docs/cloudfront_realtime_log_config: document cf.logCustomData() log fields - #49177
Merged
ewbankkit merged 2 commits intoJul 29, 2026
Merged
Conversation
added 2 commits
July 29, 2026 02:25
…fields CloudFront Functions can write custom data into the access log record for a request via the cf.logCustomData() helper method, surfaced in the viewer-request-log-data and viewer-response-log-data log fields. Both the real-time log config 'fields' set and the CloudWatch Logs delivery 'record_fields' list already accept these names (neither validates against a fixed field list), so no schema change is needed. Document them, add an end-to-end example pairing a CloudFront Function with a real-time log config, add a CloudFront standard logging (v2) example to the delivery chain docs, and cover the new fields with an acceptance test.
…the function example
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
Contributor
|
@arditti Thanks for the contribution 🎉 👏. |
Contributor
|
Warning This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
No. This change is limited to website documentation and one acceptance test.
Description
CloudFront Functions gained a
cf.logCustomData()helper method on 2026-07-14. A viewer request or viewer response function calls it to write a string into the access log record for that request, surfaced in two new log fields,viewer-request-log-dataandviewer-response-log-data. Both are available to real-time log configurations and to standard logging (v2).Neither field needs a schema change.
aws_cloudfront_realtime_log_config.fieldsis an unvalidatedTypeSetofTypeString, andaws_cloudwatch_log_delivery.record_fieldsconstrains only list size (0–128) and per-element length (1–64), which the 23- and 24-character names clear. Both already accept the new names; what was missing was documentation saying so and an example of the end-to-end pattern.website/docs/r/cloudfront_realtime_log_config.html.markdown— put the existing example under aBasic Usageheading and added aLogging Custom Data From a CloudFront Functionexample pairing anaws_cloudfront_functionthat callscf.logCustomData()with a log configuration that selects both fields, plus a note on wiring the cache behavior viafunction_associationandrealtime_log_config_arn. Extended thefieldsargument description.website/docs/r/cloudwatch_log_delivery.html.markdown— added aCloudFront Standard Logging (v2)example covering the delivery source → destination → delivery chain with both fields inrecord_fields. Since there is no first-class distribution-level standard logging (v2) resource yet (Add support for CloudFront Standard Logging (v2) to CloudWatch Logs #44832), this page is where CloudFront users land. Therecord_fieldsdescription now notes that valid field names vary by the source'slog_typeand links the CloudFront field reference.website/docs/r/cloudwatch_log_delivery_source.html.markdown— added CloudFront'sACCESS_LOGSto thelog_typeenumeration, which listed the other services but not CloudFront.internal/service/cloudfront/realtime_log_config_test.go— addedTestAccCloudFrontRealtimeLogConfig_functionLogData, covering a configuration whosefieldsset contains both new names, with an import verification step.No changelog entry: per
docs/changelog-process.md, documentation updates and testing updates are both listed under changes that should not have one.Relations
Closes #49176
References
logCustomData()): https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/general-helper-methods.html#log-custom-data-methodOutput from Acceptance Testing
The new acceptance test has not been run — no AWS credentials for a suitable non-shared account were available in the environment this was prepared in. It provisions a Kinesis stream, an IAM role and policy, and a real-time log configuration. Local verification covers build, vet, format and test compilation: