Overview
The GCP logging guides route logs to a Pub/Sub topic, and the OpenTelemetry Collector reads them from a subscription on that topic. This page creates the topic and its pull subscription, in the Google Cloud console or with the gcloud CLI.
Prerequisites
- A Google Cloud project, and permission to create Pub/Sub topics and subscriptions in it, for example the Pub/Sub Editor role.
- The Pub/Sub API turned on in the project. To turn it on yourself, as in Step 1 of the CLI tab, you also need the
serviceusage.services.enablepermission, for example from the Service Usage Admin role. Otherwise, ask a project admin to turn it on. - For the CLI: the gcloud CLI, signed in to the project.
Create the Pub/Sub Topic
Step 1. Open Pub/Sub
In the Google Cloud console, search for Pub/Sub, open it, and click CREATE TOPIC.

Step 2. Create the topic
Enter a topic ID, and select Add a default subscription. Under Encryption, keep Google-managed encryption key. Click Create.

The console opens the page of the new topic. The default subscription is named <topic-name>-sub.
Step 1. Turn on the Pub/Sub API
If the API is already on, the command does nothing. Skip this step if a project admin turned on the API for you.
gcloud services enable pubsub.googleapis.com --project=<project-id>Step 2. Create the topic
gcloud pubsub topics create <topic-name> --project=<project-id>Step 3. Create a pull subscription
gcloud pubsub subscriptions create <topic-name>-sub \
--project=<project-id> \
--topic=<topic-name>Verify these values:
<topic-name>: the Pub/Sub topic ID, for examplesignoz-logs.<project-id>: the ID of your Google Cloud project.
Validate
Make sure that the topic has the subscription:
- In the console, the topic page lists
<topic-name>-subunder Subscriptions. - With the CLI, run the command below. The output lists
projects/<project-id>/subscriptions/<topic-name>-sub.
gcloud pubsub topics list-subscriptions <topic-name> --project=<project-id>
Next Steps
Route the logs of a GCP service to the topic, for example Cloud Run, Compute Engine, or Cloud Storage.
Get Help
If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack. If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.