Skip to content

Commit

Permalink
doc(gcplog): Fix titles for Cloud provisioning for GCP logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kavirajk committed Jan 19, 2021
1 parent 6cc41f9 commit a0bb50a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions docs/sources/clients/promtail/gcplog-cloud.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
---
title: Cloud setup for gcplog TargetManager
title: Cloud setup GCP Logs
---
# Cloud setup GCP logs

This document explain how one can setup Google Cloud Platform to forward its cloud resource logs from a particular GCP project into Google Pubsub topic so that is available for Loki promtail to consume.

This document assumes, that reader have `gcloud` installed and have required permissions(as mentioned in #[Roles and Permission] section)

# Roles and Permission
## Roles and Permission

User should have following roles to complete the setup.
- "roles/pubsub.editor"
- "roles/logging.configWriter"

# Setup Pubsub Topic
## Setup Pubsub Topic

Google Pubsub Topic will act as the queue to persist log messages which then can be read from `promtail`.

```bash
Expand All @@ -22,7 +26,8 @@ e.g:
$ gcloud pubsub topics create cloud-logs
```

# Setup Log Router
## Setup Log Router

We create a log sink to forward cloud logs into pubsub topic created before

```bash
Expand All @@ -39,7 +44,8 @@ $ gcloud beta logging sinks create cloud-logs pubsub.googleapis.com/projects/my-
Above command also adds `log-filter` option which represents what type of logs should get into the destination `pubsub` topic.
For more information on adding `log-filter` refer this [document](https://cloud.google.com/logging/docs/export/configure_export_v2#creating_sink)

# Create Pubsub subscription for Loki
## Create Pubsub subscription for Loki

We create subscription for the pubsub topic we create above and `promtail` uses this subscription to consume log messages.

```bash
Expand All @@ -57,7 +63,8 @@ $ gcloud pubsub subscriptions create cloud-logs --topic=pubsub.googleapis.com/pr

For more fine grained options, refer to the `gcloud pubsub subscriptions --help`

# ServiceAccount for Promtail
## ServiceAccount for Promtail

We need a service account with following permissions.
- pubsub.subscriber

Expand Down

0 comments on commit a0bb50a

Please sign in to comment.