Each Cloud CDN request is logged in Cloud Logging. Logging is automatic and does not need to be enabled.
Logs for Cloud CDN are associated with the external HTTP(S) load balancer your Cloud CDN backends are attached to.
To view Cloud CDN logs, go to the Logs Viewer in the Cloud Platform Console.
- To see all logs, in the first pull-down menu select Load Balancing > All forwarding rules.
- To see logs for just one forwarding rule, select a single forwarding rule name from the list.
- To see logs for just one URL map used by a forwarding rule, select Load Balancing and choose the forwarding rule and URL map of interest.
What is logged
In addition to general information contained in most logs, such as severity, project ID, project number, and timestamp, HTTP(S) Load Balancing logs contain:
- The HttpRequest log fields, which captures the HTTP status code, bytes returned, and whether a cache lookup and/or cache fill was performed.
jsonPayload.cacheIdfield, which indicates the location and cache instance the cache response was served from. For example, a cache response served from a cache in Amsterdam would have a cacheId value of
AMSis the IATA code, and
85e2bd4bis an opaque identifier of the cache instance, as some Cloud CDN locations have multiple discrete caches.
statusDetailsfields of the
You can filter on these fields to determine the cache hit, miss or revalidation status of a request served by Cloud CDN:
Cache Hit Validated With Origin Server
Log fields of type boolean typically only appear if they have a value of
true. If a boolean field has a value of
false, that field is omitted from
UTF-8 encoding is enforced for these fields. Characters that are not UTF-8 characters are replaced with question marks.
When Cloud CDN serves a client request by initiating validation
requests and/or byte range requests, it omits the
serverIp field from the
Stackdriver Logging log entry for the client request. This is because
Cloud CDN can send requests to multiple server IP addresses in
reaction to a single client request.
Each request initiated by Cloud CDN creates a
Stackdriver Logging log entry. The resulting log entry contains a
parentInsertId field inside the
jsonPayload. You can use this field to
insertId of the log entry for the single client request that
prompted Cloud CDN to initiate the validation request or byte
range request. Furthermore, the log entry identifies Cloud CDN
as the user agent.
Refer to the Stackdriver Logging documentation for more information, including how to export logs to BigQuery, Cloud Pub/Sub and/or Cloud Storage, and how to configure logs-based metrics for monitoring and alerting.