Google Cloud Storage is a popular object
storage system. This guide demonstrates how to set up Cube to export logs to
Google Cloud Storage.
Configuration
First, enable monitoring integrations in Cube.
Exporting logs
To export logs to Google Cloud Storage, start by creating a bucket for Cube logs
and a service account that can write to it.
Then, put the service account key in an environment variable under Settings →
Environment variables, base64-encoded. The name must start with
CUBE_CLOUD_MONITORING_ — only variables with that prefix are available to the
Vector agent:
Finally, configure the gcp_cloud_storage
sink in your vector.toml configuration file.
Example configuration:
Commit the configuration for Vector, it should take effect in a minute. Then,
navigate to your bucket and watch the logs coming.
Authentication
Authenticate with the credentials_base64 option, referencing the environment
variable that holds the base64-encoded service account key, as in the example above.
This is the only supported way to give the sink its credentials.
credentials_base64 is specific to Cube — it does not appear in Vector’s own sink
reference. Cube decodes the key and provides it to the Vector
agent as a file named after the sink.
The sink name becomes the name of a Kubernetes object that carries the credentials
file, so it must be lowercase alphanumeric characters and dashes only — no
underscores. A sink named query_history_gcs will not get a credentials file; name
it query-history-gcs instead.
Healthcheck
The example above sets healthcheck.enabled = false. Vector’s
gcp_cloud_storage healthcheck sends a HEAD request to the bucket root, which
requires the storage.objects.list permission — write access alone, such as
roles/storage.objectCreator, does not grant it. Without this, the sink fails to
start with a forbidden-healthcheck error even though it could write objects
successfully.
With the healthcheck disabled, the sink always starts and reports healthy, so check
the bucket itself to confirm that data is arriving.
Exporting Query History
Add the query-history input to the sink to bring Query History
export data to the same bucket.
Query History export additionally requires the Monitoring Integrations Tier of
your deployment to be set to Medium (Up to 50 GB/mo). On a lower tier it fails
silently — the sink reports healthy and the bucket stays empty, with no error
logged anywhere.