# Google Pub/Sub

Apica's LogFlow can be used to push data to a PubSub topic with just a few clicks. You can forward data as is, morph the data by stripping down attributes or pick and choose the fields that you want to be sent to the Google PubSub topic

#### Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

You will need the following before you can configure forwarding to Google PubSub

1. Name of the Google PubSub topic
2. Project id ( full name not an integer ) for your GCP account project where you created the topic
3. Service account access JSON

{% hint style="info" %}
The service account must have ***pubsub.topics.publish*** permissions
{% endhint %}

You can check your service account json permissions with gcloud cli

Copy

```bash
$ gcloud auth activate-service-account --project=my-project-123 \
--key-file=sevice_account_key_file.json
$ gcloud pubsub topics publish my-gcp-topic-1 --message="hello"
messageIds:
- '6470211179713996'
$ gcloud pubsub subscriptions pull my-gcp-topic-1-sub --auto-ack
┌───────┬──────────────────┬──────────────┬────────────┬──────────────────┐
│  DATA │    MESSAGE_ID    │ ORDERING_KEY │ ATTRIBUTES │ DELIVERY_ATTEMPT │
├───────┼──────────────────┼──────────────┼────────────┼──────────────────┤
│ hello │ 6470211179713996 │              │            │                  │
└───────┴──────────────────┴──────────────┴────────────┴──────────────────┘
```

#### Creating the forwarder <a href="#creating-the-forwarder" id="creating-the-forwarder"></a>

<figure><img src="/files/Lfel2o3gQIopp3q0C7bD" alt=""><figcaption><p>Create Google PubSub forwarder</p></figcaption></figure>

#### Enter forwarder configuration <a href="#enter-forwarder-configuration" id="enter-forwarder-configuration"></a>

\
![](/files/eZI2W3MZkjQqWVciIk7g)Forwarder configuration

#### &#x20;Testing the Google PubSub forwarding <a href="#testing-the-google-pubsub-forwarding" id="testing-the-google-pubsub-forwarding"></a>

You can now test a data replay with a test stream to see if data went through


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apica.io/flow/list-of-forwarders/google-pub-sub.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
