Integrate Google Cloud Platform monitoring with Splunk Observability Cloud
The Google Cloud Platform (GCP) integration connects your GCP projects to Splunk Observability Cloud, and allows Splunk Observability Cloud to pull metrics and metadata from your GCP services.
When you send an API request, you need to use the endpoint specific to your organization's realm. To learn more, see Realms in endpoints.
To integrate GCP with Splunk Observability Cloud using the API, send a POST /v2/integration request to the GCP API with the following fields:
-
- The type of integration
- Integration name
- Authentication credentials
- Names of services from which you want to collect metrics
-
- Token name for the access token you want the system to use when collecting metrics
- Additional service domain names from which you want to collect metrics
- Metrics metadata you want to collect
- Force usage of a quota from the project where metrics are stored
- Exclude GCP Compute Engine instances with specific labels
For more details on the available fields read the API reference guide(Opens new window).
See Example: Create a GCP integration for an example of how to create a GCP integration using cURL.
Required fields
When you create a GCP integration using POST /v2/integration, the request body must contain the fields described in this section:
Type
type indicates Splunk Observability Cloud which type of integration to create. To create a GCP integration, set it to "GCP".
Name
name is the name you assign to your GCP integration in Splunk Observability Cloud. It helps you identify the integration in the UI and lets you create multiple GCP integrations with different names.
Authentication
Authenticate with Workload Identity Federation
Use Workload Identity Federation (WIF) to authenticate with Splunk Observability Cloud. WIF enables automatic synchronization of all accessible projects and enhances security by eliminating the need to export and rotate service account keys.
To authenticate using WIF, include the authMethod field set to WORKLOAD_IDENTITY_FEDERATION, along with the workloadIdentityFederationConfigs field containing the escaped configuration and your preferred project synchronization mode:
"authMethod": "WORKLOAD_IDENTITY_FEDERATION""projects": {"syncMode": "ALL_REACHABLE"},"workloadIdentityFederationConfig": "{\"json\":\"as_string\"}"
Learn more about WIF in Splunk Observability Cloud's Workload Identity Federation Setup Script(Opens new window) GitHub documentation.
Authenticate with service keys
Alternatively you can authenticate using projectServiceKeys, an array of credentials for each GCP project you want to monitor using Splunk Observability Cloud.
For each project, you need to provide the following information:
projectID: The name of a GCP project you want to monitor. You get this ID when you create a GCP project.projectKey: The contents of the service account key file for the project.
To learn how to obtain the project ID and service account key file value, see the Connect to GCP(Opens new window) topic in the Splunk Observability Cloud user documentation.
Services
services is the list of Splunk Observability Cloud-supported GCP services you want Splunk Observability Cloud to monitor. If you specify an invalid service, the system responds to your API request with an HTTP response code 400.
The system consolidates and de-duplicates service names specified in services with service domain names specified in customMetricTypeDomains. To learn more, see Duplication of service domain names and services.
The Supported GCP services section shows you a list of supported services.
Optional fields
Your request body can also contain the following optional fields:
-
namedToken: The name of an existing access token (org token) that you want Splunk Observability Cloud to use for ingesting data. If you don't include this token name, Splunk Observability Cloud uses the default access token for your organization. You get this default token as part of your organization creation. To learn more, see GCP access token name. -
customMetricTypeDomains: A list of additional GCP service domain names that you want to monitor using Splunk Observability Cloud. Use this list to specify services that Splunk Observability Cloud doesn't support. If you specify an invalid name, the system responds to your API request with an HTTP response code400. To learn how to specify custom metric type domains, see Custom metric type domains.The system consolidates and de-duplicates service domain names specified in
customMetricTypeDomainswith service names specified inservices. To learn more, see Duplication of service domain names and services. -
includeList: List of custom metadata keys that you want Splunk Observability Cloud to collect for Compute Engine instances. If you don't include this list, Splunk Observability Cloud will not collect custom metadata. This field replaces the deprecated fieldwhiteList. -
useMetricSourceProjectForQuota:falseby default. Set totrueto force usage of a quota from the project where metrics are stored. To use this, the project's service account requires aserviceusage.services.usepermission, or you need a Service Usage Consumer role in the project. -
excludeGCEInstancesWithLabels: List of label keys. GCP Compute Engine instances with any of these labels applied are excluded from metric sync. Requires thecompute.instances.listpermission on the project’s service account.
Specify GCP labels as they appear in GCP without the gcp_label_ prefix.
GCP access token name
The GCP POST and PUT request bodies include the namedToken field, which lets you specify the
name of the access token (org token) that you want Splunk Observability Cloud to use when pulling metrics from the cloud service. The token has to be an existing access token in your organization. Use the token name, not its value.
The GET response bodies for the GCP integration contain the current value of namedToken.
Custom metric type domains
A custom metric type domain is the name of a service domain for a GCP metric type. The GCP documentation specifies the following syntax for GCP resource names, resource name metric types, and service domains:
- GCP resource name: projects/PROJECT_ID/metricDescriptors/METRIC_TYPE
- GCP METRIC_TYPE sub-string: In most cases, SERVICE_DOMAIN_NAME/PATH, although the format varies.
The SERVICE_DOMAIN_NAME value is the custom metric type domain you use in customMetricTypeDomains.
Custom metric type domain examples
METRIC_TYPE | Service domain name |
|---|---|
istio.io/service/client/request_bytes | istio.io |
agent.googleapis.com/agent/api_request_count | agent.googleapis.com |
networking.googleapis.com/google_service/request_bytes_count | networking.googleapis.com |
custom.googleapis.com/my_custom_metric_name | custom.googleapis.com |
external.googleapis.com/prometheus/cpu/utilization | external.googleapis.com/prometheus |
See GCP naming conventions(Opens new window) for a detailed description of service domain names.
Duplication of service domain name and service
Splunk Observability Cloud consolidates and de-duplicates service domain names defined in customMetricTypeDomains with service names
defined in services.
The following examples demonstrate this consolidation and de-duplication. Each example results in a single synchronization
of the GCP compute service, which is equivalent to the compute.googleapis.com service domain:
Example 1: compute service
{..."services": ["compute"]"customMetricTypeDomains": [ ]...}
Example 2: compute.googleapis.com service domain name
{..."services"" [ ]"customMetricTypeDomains": ["compute.googleapis.com"]...}
Example C: compute service and compute.googleapis.com service domain name in the same request
{..."services": ["compute"]"customMetricTypeDomains": ["compute.googleapis.com"]...}
Use different service accounts to avoid throttling
Regardless of how you authenticate your account, be careful when using a single service account or a single Workload Identity Federation configuration for multiple GCP projects. More projects could generate high Cloud Monitoring API usage and potential throttling if you exceed your API quota.
Supported GCP services
See the list of the GCP integrations supported in Splunk Observability Cloud in our GCP user docs(Opens new window).
Example: Create a GCP integration
The following cURL command template shows you how to send a POST /v2/integration request to create a
GCP integration.
To authenticate the POST request, you need to specify a User API access token associated for a user who is an administrator. To learn more about authentication tokens, see Authentication Tokens.
The following example shows you an example of creating a GCP integration using cURL:
$ curl \--request POST \--header "X-SF-TOKEN: <ADMIN_SESSION_TOKEN>" \--header "Content-Type: application/json" \--data '{"type": "GCP","name": "<INTEGRATION_NAME>","namedToken": "<ACCESS_TOKEN_NAME>",
Field | Type | Description |
|---|---|---|
type | string | Always "GCP" for a GCP integration |
name | string | Name you select to help you identify this integration in your organization |
namedToken | string | Name of an existing access token (org token) Splunk Observability Cloud organization |
services | array of strings | List of GCP service names that you want to monitor |
customMetricTypeDomains | array of strings | List of additional GCP service domain names that you want to monitor |
includeList | array of strings | List of GCP metadata names that you want Splunk Observability Cloud to collect from incoming GCP data |
useMetricSourceProjectForQuota | boolean | Set to true to force usage of a quota from the project where metrics are stored |
projectServiceKeys | array of JSON objects | List of GCP projects you want to monitor |
projectId | string | Identifier of a GCP project. You set this when you create the project in GCP. |
projectKey | string | Contents of the service account key file for your GCP project. |
The response object for a successful request has the following syntax:
{"type": "GCP","name" : "<INTEGRATION_NAME>","namedToken" : "<ACCESS_TOKEN_NAME>","services" : ["<SERVICE>",...],"includeList": ["<METADATA_NAME>",...],"customMetricTypeDomains": ["<SERVICE_DOMAIN_NAME>",,,]"id" : "<INTEGRATION_ID>",
The response contains these additional field names and values:
Field | Type | Description |
|---|---|---|
id | string | ID of the new integration object that Splunk Observability Cloud created |
created | integer | Date and time that Splunk Observability Cloud added the GCP integration to your organization, in *nix time in milliseconds |
creator | string | Splunk Observability Cloud ID of the user who added the GCP integration |
lastUpdated | integer | Date and time that someone last updated the GCP integration, in *nix time in milliseconds |
lastUpdatedBy | string | Splunk Observability Cloud ID of the user who last updated the GCP integration |
To ensure security, the system doesn't return projectKey in responses. The system does return namedToken because it
contains the name of an access token rather than the token value itself.