[role="xpack"]

:type: gcp-pubsub

[id="{beatname_lc}-input-{type}"]
=== GCP Pub/Sub input

++++
<titleabbrev>GCP Pub/Sub</titleabbrev>
++++

Use the `gcp-pubsub` input to read messages from a Google Cloud Pub/Sub topic
subscription.

This input can, for example, be used to receive Stackdriver logs that have been
exported to a Google Cloud Pub/Sub topic.

Multiple Filebeat instances can be configured to read from the same subscription
to achieve high-availability or increased throughput.

Example configuration:

["source","yaml",subs="attributes"]
----
{beatname_lc}.inputs:
- type: gcp-pubsub
  project_id: my-gcp-project-id
  topic: vpc-firewall-logs-topic
  subscription.name: filebeat-vpc-firewall-logs-sub
  credentials_file: ${path.config}/my-pubsub-subscriber-credentials.json
----


==== Configuration options

The `gcp-pubsub` input supports the following configuration options plus the
<<{beatname_lc}-input-{type}-common-options>> described later.

[float]
==== `project_id`

Google Cloud project ID. Required.

[float]
==== `topic`

Google Cloud Pub/Sub topic name. Required.

[float]
==== `subscription.name`

Name of the subscription to read from. Required.

[float]
==== `subscription.create`

Boolean value that configures the input to create the subscription if it does
not exist. The default value is `true`.

[float]
==== `subscription.num_goroutines`

Number of goroutines to create to read from the subscription. This does not
limit the number of messages that can be processed concurrently or the maximum
number of goroutines the input will create. Even with one goroutine, many
messages might be processed at once, because that goroutine may continually
receive messages. To limit the number of messages being processed concurrently,
set `subscription.max_outstanding_messages`. Default is 1.


[float]
==== `subscription.max_outstanding_messages`

The maximum number of unprocessed messages (unacknowledged but not yet expired).
If the value is negative, then there will be no limit on the number of
unprocessed messages. Default is 1000.

[float]
==== `credentials_file`

Path to a JSON file containing the credentials and key used to subscribe.
As an alternative you can use the `credentials_json` config option or rely on
https://cloud.google.com/docs/authentication/production[Google Application
Default Credentials] (ADC).

[float]
==== `credentials_json`

JSON blob containing the credentials and key used to subscribe. This can be as
an alternative to `credentials_file` if you want to embed the credential data
within your config file or put the information into a keystore. You may also use
https://cloud.google.com/docs/authentication/production[Google Application
Default Credentials] (ADC).

[id="{beatname_lc}-input-{type}-common-options"]
include::../../../../filebeat/docs/inputs/input-common-options.asciidoc[]

:type!:
