cloud-logging-configuration-basics
它能做什么
这个技能帮你配置单个 Google Cloud 项目中日志的存储和查看方式。它适用于想让日志井然有序,并限制谁能看到敏感条目的团队。
适用场景
- ✓当你想为一个 Google Cloud 项目设置日志桶、日志接收器或日志视图的时候。
- ✓当需要在默认视图中隐藏敏感日志,或用 IAM 限制其访问的时候。
- ✓当你想在一个项目中添加日志排除项、采样或基于日志的指标的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/cloud-logging-configuration-basics/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我 Google Cloud 项目中的敏感审计日志隐藏起来,不让不该看到它们的人访问。”
每周 5 个新技能,1 分钟读完。
工作原理
它使用 gcloud 命令,一步一步地创建日志桶、接收器、视图和访问规则。它先进行只读检查,并在进行任何更改前请你确认。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Configuring Cloud Logging
Use this skill to configure Cloud Logging resources such as log buckets, log views, or log sinks.
[!IMPORTANT] Sandbox Network Limitation (CRITICAL for Agent Testing): During evaluation or in restricted sandboxed environments, network traffic to Google Cloud 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}. 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-configuration-basics)"
and append agent-skills/1.0 (skill:cloud-logging-configuration-basics) 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.
Getting Started
If the gcloud executable is missing, refer to the
Google Cloud CLI Installation Guide
to install it.
Creating Log Buckets (Compliance and Analytics) (Tier M)
To create a regional log bucket with a specific retention policy for regulatory compliance, and with Observability Analytics enabled:
[!WARNING] Mandatory Observability Analytics Downgrade Warning: Whenever providing guidance, writing a guide, or drafting commands on Cloud Logging cost optimization or exclusions, you must explicitly include the following warning in your final text response and any generated guides: "After a log bucket has been upgraded to use Observability Analytics, it cannot be downgraded to remove the analytics capability."
gcloud logging buckets create {bucket_id} \
--project={project_id} \
常见问题
它能处理多个项目的日志吗?
不能。它只适用于单项目设置,处理多个项目请使用跨项目技能。
它能从默认视图中隐藏日志吗?
能。它可以用过滤器限制或隐藏敏感日志。
它会不经询问就更改我的设置吗?
不会。更改需要你明确确认,并且会先进行只读检查。
详情
作者的原始描述
Configure single-project Cloud Logging on Google Cloud: regional log buckets, log sinks, log views, restricting or hiding sensitive logs in the default view (_Default) filter, IAM permissions for views (Logs View Accessor, IAM conditions), logs-based metrics, log exclusions, and sampling. Don't use for cross-project logging or multi-project setups.
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10236
- 许可证
- 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 上的第一步,包括选择项目、关联计费,以及部署第一个资源。