Skip to main content

GCP Inventory

Overview​

GCP Inventory is a pull-based source. It takes a periodic snapshot of Google Cloud assets and identities from [Cloud Asset Inventory] and sends one record per asset into a Praxis pipeline.

These records are entity context: they describe what exists (VMs, disks, networks, buckets, service accounts, roles), not what happened. A SIEM uses them to enrich events.

ResourceCloud Asset Inventory asset typesgcp.inventory.resource → Google SecOps log type
Compute: VM instances, disks, VPC networks, subnetworks, firewall rules, forwarding rulescompute.googleapis.com/Instance, Disk, Network, Subnetwork, Firewall, ForwardingRulecompute → GCP_COMPUTE_CONTEXT
Storage: Cloud Storage bucketsstorage.googleapis.com/Bucketstorage → GCP_STORAGE_CONTEXT
IAM: service accounts, service account keys, custom rolesiam.googleapis.com/ServiceAccount, ServiceAccountKey, Roleiam → GCP_IAM_CONTEXT

Supported types: Logs

Supported platforms: Linux, Windows, macOS

Minimum collector version: 0.5.71

Authentication​

The credential is optional.

Credential typeWhen to use
Google Auth (googleauth)Recommended. Supports service account JSON (inline or a file path), Workload Identity Federation, Application Default Credentials, and service account impersonation.
GCS (gcs)Reuse an existing Google Cloud Storage service account credential.
NoneThe collector uses Application Default Credentials on its host: GOOGLE_APPLICATION_CREDENTIALS, gcloud login, or the GCE / GKE identity.

On a Compute Engine VM with no credential, the VM must have the cloud-platform access scope ("Allow full access to all Cloud APIs"). With the default VM access scopes, Cloud Asset Inventory calls fail even when the IAM roles are granted.

Required IAM roles​

All calls are read-only. Grant the identity these roles on every scope (project, folder or organization):

RoleWhy it's needed
roles/cloudasset.viewer (Cloud Asset Viewer)Read asset metadata: cloudasset.assets.listResource for ListAssets.
roles/serviceusage.serviceUsageConsumer (Service Usage Consumer)Use the Cloud Asset Inventory API in the project. Google requires it with every Cloud Asset Inventory call.

Also enable the Cloud Asset Inventory API (cloudasset.googleapis.com) in the project the credential belongs to. See Cloud Asset Inventory roles and permissions.

Basic configuration​

ParameterTypeRequiredDefaultDescription
scopes (Scope)listYesWhich Google Cloud project to collect from: projects/ followed by the project ID, for example projects/test. To collect all projects in a folder or organization, use folders/<folder-id> or organizations/<organization-id> instead.
resourceslistNoall threeWhat to collect. compute: VMs, disks, networks and firewall rules. storage: buckets. iam: service accounts, their keys and custom roles.
modescheduled | manualNoscheduledscheduled: take a snapshot every interval. manual: take a snapshot only with Fetch Inventory Now.
intervalinteger (seconds)No21600 (6h)Time between full snapshots in scheduled mode. Minimum 900 (15 minutes). Hidden in manual mode.
sync_requestintegerNo0Fetch Inventory Now: shown and used in manual mode only.

Errors​

ErrorWhat happens
Quota exceeded, service unavailable, timeout, pipeline busyResume from the checkpoint after backoff.
Permission denied or not found on one scopeThat scope/resource is skipped, the rest are sent, and it is tried again at the next snapshot.
Every scope and resource failsThe snapshot is retried with backoff.

Scheduled and manual fetching​

Fetch ModeWhen snapshots run
scheduled (default)At start-up, then every Snapshot Interval. A restart waits out the rest of the interval, unless a snapshot was unfinished, in which case it resumes immediately.
manualOnly when you raise Fetch Inventory Now. Nothing runs on a timer.

Fetching on demand​

  1. Set Fetch Mode to manual.
  2. In Fetch Inventory Now, enter a number higher than the current one (for example 1 → 2).
  3. Deploy. The collector takes one full snapshot.

The completed number is saved on the collector, so a restart or a later config change with the same number does not fetch again.

Record format​

Each asset becomes one log record. Its body is the asset in the JSON shape Cloud Asset Inventory exports, which is what the Google SecOps GCP_*_CONTEXT parsers read:

Sending to Google SecOps​

One GCP Inventory source produces records for three Google SecOps log types. Between the source and the Google SecOps destination, add one Google SecOps Standardization processor per log type, each with a condition:

Log TypeCondition
GCP_COMPUTE_CONTEXTlog.attributes["gcp.inventory.resource"] == "compute"
GCP_STORAGE_CONTEXTlog.attributes["gcp.inventory.resource"] == "storage"
GCP_IAM_CONTEXTlog.attributes["gcp.inventory.resource"] == "iam"

Each processor sets the log type only on the records its condition matches, so the three can run one after another.

Example configuration​

{
"scopes": ["projects/my-project"], // required
"resources": ["compute", "storage", "iam"],
"mode": "scheduled", // default: scheduled (or "manual")
"interval": 21600, // default: 21600 (6h), minimum 900; scheduled mode only
"sync_request": 0 // manual mode: raise and deploy to fetch now
}

Operational notes​

  • Snapshots, not streaming. Every snapshot re-sends the whole inventory. Deleted resources stop appearing in the next snapshot.
  • Many projects. Use a folder or organization scope rather than listing many projects. One scope covers everything under it.
  • Quota. The ListAssets quota belongs to the credential's project and is shared with anything else using it.

Metrics​

Metric NameDescription
prx_src_records_received_total{signal="logs"}Log records emitted, one per asset. A page re-sent after a failure is counted again.
prx_src_bytes_received_totalBytes of the emitted record bodies.
prx_src_pipeline_latency_secondsArrival → downstream handoff.
prx_src_errors_total{reason}Cloud Asset Inventory or snapshot failures by reason: auth, permission_denied, timeout, io.
prx_src_records_dropped_total{reason="backpressure"}Records the downstream pipeline refused. They are re-sent from the checkpoint.