Using Console
Using CLI
[BACKEND_SERVICE_NAME]
with the name of your backend service, [LOG_NAME]
with the name of the log, and [SAMPLE_RATE]
with the sample rate for the logs.Using Python
google-cloud-logging
Python library. Here is an example code snippet to create a sink:
your-project-id
with your actual GCP project ID. This code will create a sink named “cdn-logs-sink” that exports logs from Cloud CDN to a log named “cdn” in Cloud Logging.google-cloud-cdn
Python library. Here is an example code snippet to update a backend service:your-backend-service-name
and your-project-id
with your actual backend service name and GCP project ID. This code will enable logging for the backend service and set the log sink to the one you created earlier.After running these steps, your Cloud CDN backend service should have logging enabled and the logs should be exported to Cloud Logging.