how to monitor each request and response in cloudfront?

0

I need to save this information as downloaded and uploaded headers and data and save to dynamodb or s3

2개 답변
0

Hi there. I am not sure if this satisfies your needs or not, but you can use a CloudFront function on the viewer response and inspect the event object. Doing a simple console.log(JSON.stringify(event)) will log the entire event object, which includes the request and response headers. From there, you can view the logs in CloudWatch logs.

profile pictureAWS
답변함 2년 전
  • is there any way to monitor input/output transfer data on each response and save that information to s3?

0

There are a few options that might be useful.

  1. Enable CloudFront logging - This will just generate the standard access logs and drop them in S3. I am not sure if these access logs contain the specific data you are looking for.
  2. Enable Real-Time logs - There are a few options here, but one of the most common is to use Kinesis to send a log stream to a service like AWS OpenSearch or even S3. Like option 1, I don't know if this will contain the specific data you are looking for.
  3. CloudWatch logs - This is the option I mentioned in my original answer. If you are trying to get the log data from CloudWatch into S3 then it is possible to export the CloudWatch logs into S3, or automate that process using a subscription to invoke a Lambda to perform the export.

If your goal is to get the request/response data into S3, then I think option 3 is the best bet, since I am not certain if the log files in options 1/2 contain the specific data you are looking for.

profile pictureAWS
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인