---
title: GCP PubSub
slug: telemetry-pipeline/gcp-pubsub
docTags: 
createdAt: 2025-04-21T00:51:54.515Z
---

## GCP Pub/Sub Source

The GCP Pub/Sub source retrieves observability events from **Google Cloud Pub/Sub** subscriptions. It is designed to consume log, metric, and trace data published to Pub/Sub topics and forward them into centralized observability pipelines.

This source operates in an **aggregator** role and provides **at-least-once delivery guarantees** by leveraging Pub/Sub acknowledgement semantics.

## Requirements

This source requires:

- An existing **GCP project**&#x20;
- A **Pub/Sub subscription** associated with a topic that publishes observability data&#x20;
- Appropriate IAM permissions to pull and acknowledge messages&#x20;

The subscription must be reachable using either:

- A service account&#x20;
- An API key&#x20;
- Or workload / instance identity when running on GCP infrastructure&#x20;

## Authentication and Credentials

Authentication to GCP Pub/Sub can be configured using one of the following methods:

- **Service account credentials file**&#x20;
- **API key**&#x20;
- **Implicit credentials** via the GOOGLE\_APPLICATION\_CREDENTIALS environment variable&#x20;
- **Compute instance service account** when running on GCE, GKE, or other supported GCP environments&#x20;

If multiple authentication mechanisms are present, explicit configuration takes precedence over environment-based discovery.

## Acknowledgement Handling

### Acknowledgement Deadline

The acknowledgement deadline defines how long Pub/Sub waits for a message to be acknowledged before considering it eligible for redelivery.

- **ack\_deadline\_secs**
  &#x20;Specifies the acknowledgement deadline in seconds.
  &#x20;Messages not acknowledged within this period may be retransmitted.&#x20;

The default value is **600 seconds**, which is suitable for most log ingestion pipelines where downstream processing may involve buffering or batching.

:::BlockQuote
The legacy field ack\_deadline\_seconds is deprecated and should not be used.
:::

### Source-Level Acknowledgements (Deprecated)

The following settings are deprecated and no longer affect runtime behavior:

- **acknowledgements**&#x20;
- **acknowledgements.enabled**&#x20;

Acknowledgement control is handled globally or at the sink level.
&#x20;Enabling or disabling acknowledgements at the source level has **no effect**.

## Decoding Configuration (decoding)

Controls how raw Pub/Sub message payloads are converted into events.
&#x20;Some decoders are capable of emitting **logs, metrics, or traces**, depending on the payload format.

### Supported Codecs

- bytes&#x20;
- json&#x20;
- avro&#x20;
- gelf&#x20;
- influxdb&#x20;
- syslog&#x20;
- protobuf&#x20;
- otlp&#x20;
- native&#x20;
- native\_json&#x20;
- vrl&#x20;

If no codec is specified, the payload is treated as raw bytes.

### Multi-Signal Decoding

Certain codecs (such as otlp, native, and native\_json) can automatically detect and emit different signal types:

- Logs&#x20;
- Metrics&#x20;
- Traces&#x20;

When applicable, signal parsing order can be controlled to optimize performance and avoid unnecessary decoding attempts.

### Codec-Specific Considerations

- **Lossy decoding** options allow invalid UTF-8 sequences to be replaced instead of causing failures.&#x20;
- **Avro decoding** requires a schema definition and does not support all Apache Avro logical types.&#x20;
- **Protobuf decoding** may require a descriptor set and explicit message type selection.&#x20;
- **VRL decoding** executes a Vector Remap Language program to produce the final event.&#x20;

## Framing Configuration (framing)

Framing determines how individual events are separated within a byte stream before decoding.

This is primarily relevant when message payloads contain multiple logical events.

### Supported Framing Methods

- bytes&#x20;
- newline\_delimited&#x20;
- character\_delimited&#x20;
- length\_delimited&#x20;
- varint\_length\_delimited&#x20;
- octet\_counting&#x20;
- chunked\_gelf&#x20;

Each framing strategy includes optional safety limits to prevent unbounded memory usage when processing malformed or untrusted input.

## Pub/Sub Streaming Behavior

### Concurrency and Throughput

The source maintains multiple concurrent streaming pull connections to Pub/Sub to maximize throughput.

Key behaviors include:

- Dynamically opening new streams when existing streams are busy&#x20;
- Periodically polling stream utilization&#x20;
- Backing off and retrying on transient errors&#x20;

### Flow Control and Keepalive

- **keepalive** settings ensure long-lived streaming connections remain active&#x20;
- **full response size thresholds** are used to detect subscription pressure and scale stream concurrency accordingly&#x20;

These mechanisms allow the source to efficiently handle high-volume subscriptions without overwhelming the downstream pipeline.

## Network and Endpoint Configuration

By default, the source connects to the standard GCP Pub/Sub API endpoint.
&#x20;Custom endpoints may be specified for:

- Private Service Connect&#x20;
- Regional endpoints&#x20;
- Testing or proxy-based deployments&#x20;

## Proxy Support (proxy)

Outbound connections to GCP APIs can be routed through HTTP or HTTPS proxies.

Proxy configuration supports:

- Separate HTTP and HTTPS proxy endpoints&#x20;
- Exclusion lists (no\_proxy) for specific hosts, IPs, or CIDR ranges&#x20;

This is particularly useful in **restricted enterprise networks** or **on-prem deployments** with controlled egress.

## TLS Configuration (tls)

TLS settings apply to outbound connections to the Pub/Sub API.

Supported options include:

- Custom CA certificates&#x20;
- Client certificates and private keys&#x20;
- ALPN protocol configuration&#x20;
- Certificate and hostname verification controls&#x20;

:::BlockQuote
Disabling certificate or hostname verification is strongly discouraged unless the security risks are fully understood.
:::

