Compute@Edge log streaming: Google Cloud Pub/Sub
Last updated 2022-11-30
Fastly's Real-Time Log Streaming feature for Compute@Edge services can send log files to Cloud Pub/Sub, Google's global messaging and event data ingestion product.
NOTE
Fastly does not provide direct support for third-party services. Read Fastly's Terms of Service for more information.
Prerequisites
Before adding Cloud Pub/Sub as a logging endpoint for Fastly Compute@Edge services, you will need to register for a Google Cloud Platform (GCP) account and then:
- Create a service account on Google's website.
- Navigate to the Pub/Sub section of the Google Cloud console. Follow the prompts to enable the API.
- Create a Pub/Sub topic.
- Obtain the private key from the JSON file associated with the service account configured for your Pub/Sub topic.
If you elect to use Google service account impersonation in order to avoid storing keys with Fastly you may use this same service account for that purpose. Our guide to creating an Google IAM role provides further details on this feature.
NOTE
Read more about Cloud Pub/Sub in Google’s documentation.
Adding Cloud Pub/Sub as a logging endpoint
Follow these instructions to add Cloud Pub/Sub as a logging endpoint. As part of configuration, you can elect to configure Google IAM role-based service account impersonation to avoid storing secrets. Read our guide on creating a Google IAM role for more information on this feature.
- Review the information in our guide to setting up remote log streaming for Compute@Edge. Additionally, our developer documentation provides more information about logging with Compute@Edge code written in Rust, AssemblyScript, and JavaScript.
- Click the Google Cloud Pub/Sub Create endpoint button. The Create a Google Cloud Pub/Sub endpoint page appears.
- Fill out the Create a Google Cloud Pub/Sub endpoint fields as follows:
- In the Name field, enter the endpoint name you specified in your Compute@Edge code. For example, in our Rust code example, the name is
my_endpoint_name
. - In the Project ID field, enter the ID of your Google Cloud Platform project.
- In the Topic field, enter the Pub/Sub topic to which logs should be sent.
- In the Access Method area, select how Fastly will access Google resources for purposes of log delivery. Valid values are User Credentials and IAM Role.
- If you selected User Credentials, enter the following fields:
- In the Email field, enter the email address of the service account configured for your Pub/Sub topic.
- In the Secret Key field, enter the exact value of the private key associated with the service account configured for your Pub/Sub topic.
- If you selected IAM Role, enter the following field:
- In the Service Account Name field, enter the name of the service account email address you selected when configuring Google IAM service account impersonation.
- In the Name field, enter the endpoint name you specified in your Compute@Edge code. For example, in our Rust code example, the name is
- Click the Create button to create the new logging endpoint.
- Click the Activate button to deploy your configuration changes.
Do not use this form to send sensitive information. If you need assistance, contact support.