aldy120 / cloudfront-note

Notes for AWS CloudFront documentation
0 stars 0 forks source link

How to add the logs into origin server #14

Open aldy120 opened 4 years ago

aldy120 commented 4 years ago

Add the x-amz-cf-id into nginx or apache logs. It help you to troubleshoot easily. https://www.slideshare.net/AmazonWebServices/stg206-using-amazon-cloudfront-for-your-websites-apps/19

aldy120 commented 4 years ago

Ningx

log_format  main  $remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for" "$http_x_amz_cf_id"';

Apache

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"${X-Amz-Cf-Id}i\"" combined