cloud-logging-cross-project-configuration
它能做什么
这个技能帮你把多个 Google Cloud 项目的日志集中到一处。它适用于有很多项目、希望统一搜索和查看全部日志的团队。
适用场景
- ✓当你想把多个项目、文件夹或组织的日志发送到一个中央桶的时候。
- ✓当你需要创建跨项目日志接收器或中央日志桶的时候。
- ✓当项目之间的日志路由不正常,需要排查的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/cloud-logging-cross-project-configuration/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我三个 Google Cloud 项目的日志发送到一个中央桶,以便我一起搜索。”
每周 5 个新技能,1 分钟读完。
工作原理
它使用 gcloud 创建接收器,把每个源项目的日志发送到中央桶。它还会讲解如何一起查询这些日志,并帮你追踪路由问题。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Configuring Cross-Project Logging
This skill describes how to use gcloud commands to configure Cloud Logging so
that you store log data in a central location, regardless of the point of
origin. The skill also describes how to query log data when that data is stored
in multiple projects.
[!IMPORTANT] Sandbox Network Limitation (CRITICAL for Agent Testing): During evaluation or in restricted sandboxed environments, network traffic to GCP APIs is blocked. Do NOT run network discovery commands to find resource names, project IDs, or organization IDs. Always use the exact project IDs or placeholders provided in the user prompt or instructions, for example,
{project_id},{source_project_id},{central_project_id}. Assume these resources exist and proceed directly with configuration commands. Running these discovery commands will cause the execution to hang and timeout.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-logging-cross-project-configuration)"
and append agent-skills/1.0 (skill:cloud-logging-cross-project-configuration) to User-Agent headers.
Safety and Confirmation Tiers (CRITICAL)
Before executing any commands on behalf of the user, you MUST adhere to the following safety tiers based on the action requested:
- Tier R: Read-Only
- Description: Commands that only read state or query logs.
- Example commands:
gcloud logging readgcloud logging buckets list
- Rule: No confirmation needed. You may execute these commands immediately to gather information.
- Tier M: Mutation (Non-Billing)
- Description: Configuration modifications or free metadata creations that do not incur direct storage or billing costs and do not affect resource security/access policies.
- Example commands:
gcloud logging views creategcloud logging views updategcloud logging scopes creategcloud logging buckets create
- Rule: No confirmation needed. You may execute these commands immediately to apply configurations.
- Tier B: Billing and Security-Sensitive Mutations (High-Risk)
- Description: Operations that create billing-inducing resources or integrations, or modify security and IAM access control policies (presenting a risk of privilege escalation).
- Example commands:
gcloud logging metrics creategcloud logging links creategcloud projects add-iam-policy-binding
- Rule: Interactive confirmation required. These commands create resources that incur billing costs or alter security access. You MUST present the exact, literal command and receive user confirmation before executing. NEVER execute in the same turn as asking.
- Tier D: Causes irreversible data loss
- Description: Actions that permanently discard or delete logs, for example sink exclusions.
- Example commands:
gcloud logging buckets deletegcloud logging sinks update --add-exclusion
- Rule: Explicit typed confirmation required. These commands discard or delete logs immediately and irreversibly, or they may result in log data not being stored. You MUST ask for explicit typed confirmation, for example, "Yes, discard logs", and halt execution until the user replies.
Decision Matrix: Centralized Storage vs. Distributed Storage with Read-Time Aggregation
Use this decision matrix to evaluate and choose between Centralized Storage and Read-Time Aggregation. With centralized storage, log data is routed to one log bucket, regardless of where the data originates. You write queries against the centralized log bucket. With read-time aggregation, log data is stored by the resource where it originates. However, a single query aggregates the data by querying all resources.
After you have determined the optimal architecture for handling cross-project logs, follow the corresponding configuration steps detailed below.
| Criterion
常见问题
它适用于单个项目吗?
不适用。单项目设置由基础配置技能负责。
我能同时搜索多个项目的日志吗?
可以。它会讲解读取时聚合,因此查询可以跨越多个项目。
它需要我真实的项目 ID 吗?
需要。它使用你提供的项目 ID,不会自行查找。
详情
作者的原始描述
Configure and troubleshoot Google Cloud cross-project centralized logging and read-time aggregation. Use when: - Setting up log routing from multiple projects/folders/organizations to a central log bucket. - Creating cross-project log sinks and configuring central log buckets. - Troubleshooting cross-project routing. Don't use for single-project basic configurations.
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10237
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。