cloud-logging-configuration-basics

Configure Google Cloud Logging buckets, sinks, views, metrics, and exclusions with gcloud commands.

19.1k|1.5k|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/google/skills --skill cloud-logging-configuration-basics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloud-logging-configuration-basics
Source: https://github.com/google/skills/tree/main/skills/cloud/cloud-logging-configuration-basics
Command: npx skills add https://github.com/google/skills --skill cloud-logging-configuration-basics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing Google Cloud Logging configuration requires knowing many gcloud commands and understanding which operations are safe, billable, or destructive. This Skill guides an AI agent through configuring single-project Cloud Logging resources while enforcing safety tiers that prevent accidental data loss or unexpected billing.

Core Features & Use Cases

  • Log Buckets and Sinks: Create regional log buckets with retention policies and Observability Analytics, then route logs to them with sinks.
  • Sensitive Log Access Control: Restrict visibility of sensitive logs using log views, IAM conditions, and the Logs View Accessor role.
  • Cost Optimization: Reduce logging costs with sink exclusions and sampling filters for high-volume logs.
  • Logs-Based Metrics: Create counter metrics from log filters for alerting on patterns like OutOfMemory errors.
  • Use Case: A security team needs to hide Data Access audit logs from general viewers while granting a security group access through a dedicated log view with an IAM condition.

Quick Start

Ask the agent to create a regional log bucket with a one-year retention policy and route specific logs to it in your Google Cloud project.

Frequently Asked Questions about cloud-logging-configuration-basics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a log bucket in Google Cloud Logging?

Use gcloud logging buckets create with a bucket ID, project, location, and retention days. Add --enable-analytics for Observability Analytics, which requires a regional bucket and cannot be removed once enabled.

How to restrict access to sensitive logs in Cloud Logging?

Update the _Default log view filter to exclude the sensitive log ID, then create a dedicated log view containing those logs. Grant access with roles/logging.viewAccessor scoped by an IAM condition to that specific view.

How do I reduce Google Cloud Logging costs?

Add exclusions to log sinks to stop ingesting high-volume, low-value logs, or use the sample() function in an exclusion filter to discard a fraction of matching entries. Both actions are destructive and require explicit confirmation.

Can this skill manage cross-project or multi-project logging?

No. The skill explicitly covers single-project Cloud Logging configuration only. For aggregated sinks or multi-project log routing setups, a different approach is required.

What happens when I add a sink exclusion in Cloud Logging?

Matching log entries are discarded immediately and irreversibly before being written to storage. The skill requires explicit typed confirmation, such as confirming the specific log ID to exclude, before executing the exclusion command.