---
title: GCP Cloud Storage
slug: telemetry-pipeline/gcp-cloud-storage
docTags: 
createdAt: 2025-04-21T00:59:20.073Z
---

# GCP Cloud Storage Sink

## Overview

The **GCP Cloud Storage (GCS) sink** stores **observability events** in **Google Cloud Storage** as objects.
&#x20;It is commonly used for **long-term retention**, **cost-efficient archival**, and **downstream batch analytics** (for example: BigQuery external tables, Dataproc/Spark, or custom pipelines reading from GCS).

This sink is a good fit when:

- you want **cheap storage at scale** and don’t need “query-now” semantics,&#x20;
- you want to keep logs in GCP for **compliance / audit**,&#x20;
- you want to build a **data lake** workflow (GCS → ETL → warehouse).&#x20;

## Supported Input Types

- Logs&#x20;

## Authentication

The sink supports multiple authentication mechanisms. One of the following must be available:

- **Service account credentials file** (via credentials\_path)&#x20;
- **API key** (via api\_key)&#x20;
- **Application Default Credentials (ADC)** via environment / instance identity&#x20;

If no explicit credentials are configured:

- the GOOGLE\_APPLICATION\_CREDENTIALS environment variable is checked,&#x20;
- otherwise, instance-level service accounts are used when running on Google Compute Engine.&#x20;

## Required Configuration

### Bucket (required)

Defines the target **GCS bucket** where objects are written.

Key notes:

- must already exist,&#x20;
- access permissions must allow object creation.&#x20;

### Encoding (required)

Defines how events are serialized into bytes before writing them to objects.

The encoding configuration selects a codec such as:

- JSON&#x20;
- Text&#x20;
- Avro&#x20;
- Protobuf&#x20;
- CEF&#x20;
- CSV&#x20;
- etc.&#x20;

Encoding also determines what structure the resulting objects contain and how easily downstream systems can parse them.

## Object Naming and Partitioning

### Key Prefix

Defines a prefix for object keys.
&#x20;This is the primary mechanism for creating directory-like partitioning in the bucket.

Typical uses:

- date-based partitioning (daily/hourly),&#x20;
- environment or tenant partitioning,&#x20;
- source-type partitioning.&#x20;

Important behavior:

- if you intend to use the prefix as a “folder path”, it must end with / (a trailing slash is not automatically added),&#x20;
- supports per-event templating, so keys can be dynamically derived from event fields.&#x20;

### Filename Timestamp Formatting

Controls the time component used in the generated object keys.

Key behavior:

- by default, objects include a timestamp (commonly rendered as seconds since Unix epoch),&#x20;
- changing the format affects how objects are grouped and how predictable the object paths are,&#x20;
- setting it to an empty string disables timestamp appending.&#x20;

### Filename Extension

Controls the file extension suffix used for written objects.

Behavior:

- if unset, the extension is derived from compression scheme (when applicable),&#x20;
- if set, the extension is forced to the configured value.&#x20;

### Append UUID to Filenames

Controls whether a UUID v4 token is appended to the generated object key.

Why this matters:

- prevents name collisions in high-volume or concurrent workloads,&#x20;
- improves safety when multiple writers generate identical time-based keys.&#x20;

Default behavior is typically collision-safe for parallel pipelines.

## Storage and Access Control

### Storage Class

Controls the GCS storage class used for created objects:

- STANDARD&#x20;
- NEARLINE&#x20;
- COLDLINE&#x20;
- ARCHIVE&#x20;

Use this to optimize costs based on access patterns:

- frequent reads → STANDARD,&#x20;
- infrequent reads / archival → NEARLINE/COLDLINE/ARCHIVE.&#x20;

### Object ACL

Applies a predefined ACL to created objects.

Use this to enforce object-level read access patterns (for example: private vs. project-private vs. public-read) depending on your bucket policy model.

### Metadata

Adds custom key/value metadata to created objects.

Typical uses:

- dataset identifiers,&#x20;
- pipeline provenance,&#x20;
- compliance tags,&#x20;
- downstream processing hints.&#x20;

## Delivery Shaping

### Batch Behavior

Controls how events are grouped into batches before being written.

Batch sizing influences:

- object size (fewer larger objects vs. many small objects),&#x20;
- upload overhead and API call rate,&#x20;
- end-to-end latency from ingest to availability in GCS.&#x20;

### Buffering Behavior

Defines local buffering behavior when writes are temporarily constrained.

Supported buffer strategies:

- **Memory buffering** for higher throughput,&#x20;
- **Disk buffering** for better durability across restarts.&#x20;

When the buffer is full, behavior can be configured to:

- block upstream (backpressure),&#x20;
- or drop newest events if prioritizing throughput.&#x20;

### Compression

Controls whether objects are compressed before upload:

- none&#x20;
- gzip&#x20;
- zstd&#x20;
- snappy&#x20;
- zlib&#x20;

Compression tradeoffs:

- reduces storage and egress costs,&#x20;
- increases CPU usage,&#x20;
- may affect downstream tooling depending on decompression support.&#x20;

## Framing

Controls how multiple events are delimited inside an object.

Framing impacts downstream parsing behavior, especially for:

- newline-delimited JSON,&#x20;
- length-delimited formats,&#x20;
- raw byte streams.&#x20;

Supported framing methods include:

- bytes (no delimiters),&#x20;
- newline-delimited,&#x20;
- character-delimited,&#x20;
- length-delimited,&#x20;
- varint length-delimited.&#x20;

## Network and Transport Controls

### Endpoint

Overrides the GCS API endpoint.

Defaults to the standard Google Cloud Storage endpoint.
&#x20;Useful for special environments, testing, or endpoint routing controls.

### Proxy Support

Supports HTTP and HTTPS proxies with optional exclusions.

Used in environments with:

- restricted outbound access,&#x20;
- centralized egress gateways,&#x20;
- regulated network paths.&#x20;

### Request Behavior

Advanced request controls allow fine-tuning outbound behavior:

- adaptive or fixed concurrency,&#x20;
- rate limiting aligned with quotas,&#x20;
- retry strategies with backoff,&#x20;
- request timeouts.&#x20;

These are typically tuned for:

- high-volume pipelines,&#x20;
- quota-constrained environments,&#x20;
- multi-sink deployments.&#x20;

### TLS Configuration

Supports TLS settings including:

- custom certificate authorities,&#x20;
- client certificate and key configuration,&#x20;
- strict certificate and hostname verification.&#x20;

TLS should be enabled whenever objects are written over untrusted networks.

## Timezone Handling

### Timezone

Defines the timezone used when rendering date specifiers in template strings (for example, when using date-based key\_prefix patterns).

If unset:

- defaults to the globally configured worker's timezone,&#x20;
- can be set to a TZ database name or local.&#x20;

This matters when you partition by day/hour and want partitions aligned to a specific operational timezone.
