# Stream Logs using Pub/Sub

{% hint style="info" %}
This feature is only available for [BYOC](https://docs.groundcover.com/architecture/byoc) deployments
{% endhint %}

groundcover is able to ingest natively into the platform using GCP's Pub/Sub features. Follow the instructions below to set up the integration:

1. Get your dedicated Pub/Sub topic details from groundcover's team
2. Create a new sink in `Log Router` connected to the Pub/Sub topic
3. Share the new sink details with the groundcover team

### Retrieving the Pub/Sub topic name

For purposes of the integration, groundcover will provision a new topic in the BYOC project. You will need this topic name when setting up the log router sink in the next step.

{% hint style="success" %}
Contact the groundcover team to retrieve the topic name
{% endhint %}

### Create a Log Router sink

In the `Log Router` page in the GCP console, create a new logging sink.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-b9de963053c637bfe7833ba7d0aadfe9b93ae9bb%2Fimage%20(134)%20(1).png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

1. Sink Details -
   1. Name - Choose a name that fits your needs.\
      **Example**: `groundcover_logs`
2. Sink Destination -
   1. Sink Service - Select `Cloud Pub/Sub topic`
   2. Click on the `Select a Cloud Pub/Sub topic` dropdown, and click on `Enter topic manually`. In the new box fill in the topic name received in the previous step.\
      **Example: `projects/groundcover-project/topics/groundcover-incloud-gcp-id-topic`**
3. Choose logs to include in the sink -
   1. Create a filter of your choosing.\
      Example: `resource.labels.service_name="my-service-name"`

### Share sink details with the groundcover team

After creating the new sink, browse back to the `Log Router` page. You will see the new sink in the list. On the right side of the page, click on `More Actions` -> `View sink details.`

Share the `Writer identity` value with the groundcover team.

{% hint style="info" %}
groundcover needs the `Writer identity` to allow the new sink to push logs into the Pub/Sub topic associated with your account.
{% endhint %}

### Browse logs in the groundcover platform

Once the groundcover team finishes the setup, logs will start streaming into your environment, appearing in the native logs screen.

The logs will automatically be enriched with various attributes, two of which will help you quickly find your logs:

1. `environmentType` will be set as `gcp`
2. `workload` will be set as the service name deduced from GCP label `resource.labels.service_name`
