---
title: "GCP logs: Alloy + Pub/Sub | Grafana Labs"
description: "Collect GCP logs using Grafana Alloy with Pub/Sub."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# GCP logs: Alloy + Pub/Sub

**Complexity:** Moderate | **Infrastructure:** Pub/Sub + Alloy | **Latency:** Streaming

[![GCP logs collection pipeline](gcp-logs-pipeline.svg)](gcp-logs-pipeline.svg "GCP logs collection pipeline")

You create a log sink in Cloud Logging with filters that select which logs to export. The sink routes them to a topic in Pub/Sub, Google Cloud’s managed messaging service. Alloy subscribes to the topic, processes the logs, and forwards them to Grafana Cloud Logs. Sink filters let you reduce volume at the source.

## Considerations

- Log sink filtering to reduce volume
- Application Default Credentials for Alloy
- Processing pipeline for filtering and relabeling
- Alloy infrastructure to deploy, maintain, and update
- Pub/Sub cost, plus setup steps

## Documentation

View the [GCP logs](/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/gcp/config-gcp-logs/) documentation.
