Score:0

Logging custom request headers with AWS CloudFront

ng flag

What is the best way to log custom HTTP headers like X-Foo: bar received by CloudFront?

I haven't tried Real-time logs, but Standard access logs seem to log only the pre-defined set of fields/headers. My custom ones do not show up in there.

Currently I am thinking of leveraging CloudFront Functions for some custom logging. Is there any better (more easy/efficient) approach?

Score:1
gp flag
Tim

Is there any reason you need to log this at the network edge rather than at your web server? Web server logging would seem to be a simple way to do this, if you're using a web server. If you're using S3 or similar as a source it might not be practical. Perhaps you could edit your question to give more context.

CloudFront functions can log to Cloudwatch Logs. If you need to log at the edge that seems like a reasonable option.

Greendrake avatar
ng flag
Edge logging is required simply because most requests _do not reach_ the source (which is indeed the purpose of the edge!). Besides, the source is S3 indeed. Good to know re cf functions->cloudwatch logs, thank you.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.