[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6990J78X38BSBPFDGNXQ7BA":3,"skill-same:01M6990J78X38BSBPFDGNXQ7BA":88},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":59,"commitSha":60,"skillDirectory":61,"forksCount":62,"repositoryHtmlUrl":63,"repositoryHomepageUrl":17,"ownerHtmlUrl":64,"ownerBlogUrl":65,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M6990J78X38BSBPFDGNXQ7BA","cloud-logging-configuration-basics","Cloud Logging 日志配置基础","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.","在 Google Cloud 上配置单项目 Cloud Logging：区域日志存储桶（regional log buckets）、日志接收器（log sinks）、日志视图（log views）、在默认视图（_Default）过滤器中限制或隐藏敏感日志、视图的 IAM 权限（Logs View Accessor、IAM 条件）、基于日志的指标（logs-based metrics）、日志排除（log exclusions）以及采样。不适用于跨项目日志或多项目配置。","google\u002Fskills","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M698WR0H76ENHE587T9EJT89",24235,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-logging-configuration-basics\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD3B3T8FK02S5JVCZA1M","运维监控与告警","SCENARIO","使用场景",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师","PROFESSION","适用职业",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,10],"basics","cloud","configuration","logging","cloud logging configuration basics","default","permissions","multi","iam","filter","log","logs","configure","use","single","sampling","project","for","view","google cloud","2026-11-10 10:12:30",false,"---\nname: cloud-logging-configuration-basics\ndescription: >-\n  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,\n  IAM permissions for views (Logs View Accessor, IAM conditions), logs-based metrics, log exclusions, and sampling.\n  Don't use for cross-project logging or multi-project setups.\nmetadata:\n  version: \"1.0.3\"\n  category: CloudObservabilityAndMonitoring\n---\n\n# Configuring Cloud Logging\n\nUse this skill to configure Cloud Logging resources such as log buckets, log\nviews, or log sinks.\n\n> [!IMPORTANT] **Sandbox Network Limitation (CRITICAL for Agent Testing):**\n> During evaluation or in restricted sandboxed environments, network traffic to\n> Google Cloud APIs is blocked. Do **NOT** run network discovery commands to\n> find resource names, project IDs, or organization IDs. Always use the exact\n> project IDs or placeholders provided in the user prompt or instructions for\n> example, `{project_id}`. Assume these resources exist and proceed directly\n> with configuration commands. Running these discovery commands will cause the\n> execution to hang and timeout.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:cloud-logging-configuration-basics)\"`\nand append `agent-skills\u002F1.0 (skill:cloud-logging-configuration-basics)` to `User-Agent` headers.\n\n## Safety and Confirmation Tiers (CRITICAL)\n\nBefore executing any commands on behalf of the user, you MUST adhere to the\nfollowing safety tiers based on the action requested:\n\n1.  **Tier R: Read-Only**\n    *   **Description:** Commands that only read state or query logs.\n    *   **Example commands:**\n        *   `gcloud logging read`\n        *   `gcloud logging buckets list`\n    *   **Rule:** No confirmation needed. You may execute these commands\n        immediately to gather information.\n2.  **Tier M: Mutation (Non-Billing)**\n    *   **Description:** Configuration modifications or free metadata creations\n        that do not incur direct storage or billing costs and do not affect\n        resource security\u002Faccess policies.\n    *   **Example commands:**\n        *   `gcloud logging views create`\n        *   `gcloud logging views update`\n        *   `gcloud logging scopes create`\n        *   `gcloud logging buckets create`\n    *   **Rule:** No confirmation needed. You may execute these commands\n        immediately to apply configurations.\n3.  **Tier B: Billing and Security-Sensitive Mutations (High-Risk)**\n    *   **Description:** Operations that create billing-inducing resources or\n        integrations, or modify security and IAM access control policies\n        (presenting a risk of privilege escalation).\n    *   **Example commands:**\n        *   `gcloud logging metrics create`\n        *   `gcloud logging links create`\n        *   `gcloud projects add-iam-policy-binding`\n    *   **Rule:** **Interactive confirmation required.** These commands create\n        resources that incur billing costs or alter security access. You MUST\n        present the exact, literal command and receive user confirmation before\n        executing. NEVER execute in the same turn as asking.\n4.  **Tier D: Causes irreversible data loss**\n    *   **Description:** Actions that permanently discard or delete logs, for\n        example sink exclusions.\n    *   **Example commands:**\n        *   `gcloud logging buckets delete`\n        *   `gcloud logging sinks update --add-exclusion`\n    *   **Rule:** **Explicit typed confirmation required.** These commands\n        discard or delete logs immediately and irreversibly, or they may result\n        in log data not being stored. You MUST ask for explicit typed\n        confirmation, for example, \"Yes, discard logs\", and halt execution until\n        the user replies.\n\n## Getting Started\n\nIf the `gcloud` executable is missing, refer to the\n[Google Cloud CLI Installation Guide](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk.md.txt)\nto install it.\n\n## Creating Log Buckets (Compliance and Analytics) (Tier M)\n\nTo create a regional log bucket with a specific retention policy for regulatory\ncompliance, and with Observability Analytics enabled:\n\n> [!WARNING] **Mandatory Observability Analytics Downgrade Warning:** Whenever\n> providing guidance, writing a guide, or drafting commands on Cloud Logging\n> cost optimization or exclusions, you **must** explicitly include the following\n> warning in your final text response and any generated guides: \"After a log\n> bucket has been upgraded to use Observability Analytics, it **cannot be\n> downgraded** to remove the analytics capability.\"\n\n```bash\ngcloud logging buckets create {bucket_id} \\\n    --project={project_id} \\\n    --location={region} \\\n    --retention-days={retention_days} \\\n    --enable-analytics\n```\n\n*   `{bucket_id}`: for example, `my-custom-bucket`\n*   `{region}`: for example, `global` or `us-central1`. Observability Analytics\n    is supported in both global and regional log buckets.\n*   `{retention_days}`: for example, `365`\n\nA log bucket incurs no storage or ingestion charges until logs are routed to it\nwith a log sink.\n\n### Verify the Log Bucket (Tier R)\n\nCheck the log bucket's configuration to verify its compliance:\n\n```bash\ngcloud logging buckets describe {bucket_id} \\\n    --location={region} \\\n    --project={project_id}\n```\n\n### Route logs to the Log Bucket (Tier B)\n\n> [!IMPORTANT] **Billing Action (Tier B):** Routing log entries to a bucket\n> incurs ongoing charges based on the volume of data stored. You MUST get\n> interactive user confirmation before running this command.\n\nLog entries are stored in the log bucket only if a log sink filter matches the\nentries and targets that bucket.\n\nTo route log entries to the log bucket:\n\n```bash\ngcloud logging sinks create {sink_id} \\\n    projects\u002F{project_id}\u002Flocations\u002F{region}\u002Fbuckets\u002F{bucket_id} \\\n    --log-filter='{filter_expression}' \\\n    --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## Logs-Based Metrics\n\nLogs-based metrics count the number of log entries that match a filter, allowing\nyou to track error rates and set up alerting policies.\n\n### 1. Create a logs-based counter metric (Tier B)\n\n> [!IMPORTANT] **Billing Action (Tier B):** Creating logs-based metrics incurs\n> ongoing charges based on the volume of data points reported. You MUST get\n> interactive user confirmation before running this command.\n\nTo count the occurrences of a specific log pattern, for example, \"OutOfMemory\"\nerrors:\n\n```bash\ngcloud logging metrics create {metric_name} \\\n    --log-filter='{filter_expression}' \\\n    --description='{description}' \\\n    --project={project_id}\n```\n\n*   `{metric_name}`: for example, `oom_error_count`\n*   `{filter_expression}`: for example, `textPayload:\"OutOfMemory\"`\n*   `{description}`: for example, \"Count of log entries about OOMs\"\n\nRefer to\n[REST Resource: projects.metric](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Freference\u002Fv2\u002Frest\u002Fv2\u002Fprojects.metrics.md.txt#LogMetric)\nfor restrictions on the metric fields.\n\n### 2. Verify the logs-based metric (Tier R)\n\nTo verify that the metric exists and inspect its configuration, use the\n`describe` command:\n\n```bash\ngcloud logging metrics describe {metric_name} \\\n    --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## Restricting Access to Sensitive Logs (Security)\n\nAnyone with `roles\u002Flogging.viewer` on that project can see logs in a project's\n`_Default` log bucket via `_Default` log view. To restrict visibility of the\nlogs:\n\n> [!IMPORTANT] **Ambiguity Handling (Guidance for Agents):** If the user asks to\n> \"exclude\", \"hide\", or \"remove\" sensitive logs without explicitly specifying\n> whether they want to stop storing them, you **MUST** default to **excluding\n> them from the default view (Step 1)**. This is a safe, non-destructive Tier M\n> action. Only configure a storage exclusion (under the \"Discarding Sensitive\n> Logs from Storage\" section) if the user explicitly uses destructive terms like\n> *\"stop storing\"*, *\"permanently discard\"*, or *\"sink exclusion\"*.\n\n### 1. Exclude sensitive logs from default view (Tier M)\n\nTo explicitly exclude sensitive logs from general access, update the filter for\nthe `_Default` log view:\n\n```bash\ngcloud logging views update _Default \\\n    --bucket=_Default \\\n    --location=global \\\n    --project={project_id} \\\n    --log-filter='NOT LOG_ID(\"cloudaudit.googleapis.com\u002Fdata_access\") AND NOT LOG_ID(\"externalaudit.googleapis.com\u002Fdata_access\") AND NOT LOG_ID(\"{sensitive_log_id}\")'\n```\n\n### 2. Create a log view (Tier M)\n\nCreate a new log view that includes the sensitive logs in the project's\n`_Default` log bucket. For example, a \"security-logs-view\" with access to the\n`{sensitive_log_id}`\n\n```bash\ngcloud logging views create security-logs-view \\\n    --bucket=_Default \\\n    --location=global \\\n    --project={project_id} \\\n    --log-filter='LOG_ID(\"{sensitive_log_id}\")' \\\n    --description=\"Sensitive logs\"\n```\n\n### 3. Grant access to log view using IAM conditions (Tier B)\n\n> [!IMPORTANT] **Security Action (Tier B):** Granting IAM permissions changes\n> access control policy and must be explicitly confirmed by the user before\n> execution.\n\nTo restrict access to log view use IAM. When granting the Logs Viewer Accessor\nrole, always attach an IAM condition that restricts the grant to a specific log\nview. For example, to grant `{security_group_email}` access ONLY to the\n`security-logs-view` in the `_Default` bucket:\n\n```bash\ngcloud projects add-iam-policy-binding {project_id} \\\n--member='group:{security_group_email}' \\\n--role='roles\u002Flogging.viewAccessor' \\\n--condition=\"expression=resource.name=='projects\u002F{project_id}\u002Flocations\u002Fglobal\u002Fbuckets\u002F_Default\u002Fviews\u002Fsecurity-logs-view',title=Restricted to Specific Log View,description=Only allows access to the specified log view\"\n```\n\nReplace `{location}` with the location of the log bucket, for example `global`\nor a regional location like `us-central1`.\n\n### 4. Verify Sensitive Log Restrictions (Tier R)\n\nTo verify that your Log View for sensitive logs is configured correctly:\n\n```bash\ngcloud logging views describe {view_id} \\\n    --bucket={bucket_id} \\\n    --location={region} \\\n    --project={project_id}\n```\n\nEnsure that the `filter` block contains the appropriate restriction expression.\n\n--------------------------------------------------------------------------------\n\n## Discarding Sensitive Logs from Storage (Tier D)\n\nIf your organization's compliance policies prohibit storing sensitive logs at\nall, you can configure an exclusion to discard them before they are written to\ndisk.\n\n> [!CAUTION] **Destructive Action (Tier D):** Excluding logs from all log sinks\n> deletes the log entries immediately and irreversibly.\n>\n> **Safety Rule:** You MUST ask the user for explicit typed confirmation, for\n> example, \"I confirm I want to exclude `{sensitive_log_id}` logs from storage\",\n> before running this command. **Same-Turn Restriction:** Do NOT execute the\n> `gcloud logging sinks update` command in the same turn as asking for\n> confirmation. Stop tool execution immediately and wait for the user to reply.\n\n**Exclude sensitive logs from storage using sink exclusions**\n\n```bash\ngcloud logging sinks update _Default \\\n    --project={project_id} \\\n    --add-exclusion=name=exclude-sensitive,filter='LOG_ID(\"{sensitive_log_id}\")'\n```\n\n--------------------------------------------------------------------------------\n\n## Cost Optimization (Reducing Logging Costs)\n\nCloud Logging costs are based on the volume of data ingested and stored. You can\nreduce costs by excluding high-volume, low-value logs or by sampling them. Each\nlog sink that routes logs to a distinct log bucket contributes to cost and is a\ncandidate for optimization.\n\n> [!CAUTION] **Destructive Actions (Tier D):** Exclusions in this section may\n> immediately halt storage of log entries.\n>\n> **Safety Rule:** You MUST ask for explicit typed confirmation (for example, \"I\n> confirm I want to exclude load balancer logs\") before executing exclusions or\n> sampling updates.\n\n### Exclude all high-volume logs (Tier D)\n\nTo completely stop ingesting a specific type of log into a log bucket, add an\nexclusion to the log sinks that route logs into that bucket.\n\n```bash\ngcloud logging sinks update {sink_id} \\\n    --project={project_id} \\\n    --add-exclusion=name={exclusion_name},filter={exclusion_filter}\n```\n\n*   `{sink_id}`: for example '_Default'\n*   `{exclusion_name}`: for example 'exclude-lb-logs'\n*   `{exclusion_filter}`: for example 'resource.type=\"http_load_balancer\"'\n\n### Sample high-volume logs (Tier D)\n\nIf you need some logs for analysis but want to reduce volume, use the `sample()`\nfunction in the exclusion filter.\n\n> [!IMPORTANT] The `sample(field, fraction)` function matches a `fraction` of\n> logs. When used in an **exclusion filter**, the matched logs are\n> **discarded**. If you exclude 90% of log entries, then only 10% are retained.\n> To exclude 90%, use `sample(insertId, 0.9)` in the exclusion filter.\n\nTo exclude 90% of `DEBUG` severity logs:\n\n```bash\ngcloud logging sinks update _Default \\\n    --project={project_id} \\\n    --add-exclusion=name=sample-debug-logs,filter='severity=DEBUG AND sample(insertId, 0.9)'\n```\n\n### Verify Log Exclusions and Cost Optimization (Tier R)\n\nTo verify that log exclusions are correct, list the details of the sink and\ncheck the `exclusions` to ensure your filter is present. For example, for the\n`_Default` sink:\n\n```bash\ngcloud logging sinks describe _Default --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## References and Supporting Links\n\n*   [Cloud Logging - Counter Metrics](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Flogs-based-metrics\u002Fcounter-metrics.md.txt)\n*   [Cloud Logging - Custom Log Views](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Flogs-views.md.txt)\n*   [Cloud Logging - Exclusions](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Frouting\u002Foverview.md.txt)\n","# Configuring Cloud Logging\n\nUse this skill to configure Cloud Logging resources such as log buckets, log\nviews, or log sinks.\n\n> [!IMPORTANT] **Sandbox Network Limitation (CRITICAL for Agent Testing):**\n> During evaluation or in restricted sandboxed environments, network traffic to\n> Google Cloud APIs is blocked. Do **NOT** run network discovery commands to\n> find resource names, project IDs, or organization IDs. Always use the exact\n> project IDs or placeholders provided in the user prompt or instructions for\n> example, `{project_id}`. Assume these resources exist and proceed directly\n> with configuration commands. Running these discovery commands will cause the\n> execution to hang and timeout.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\u002Fattribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\u002F1.0 (skill:cloud-logging-configuration-basics)\"`\nand append `agent-skills\u002F1.0 (skill:cloud-logging-configuration-basics)` to `User-Agent` headers.\n\n## Safety and Confirmation Tiers (CRITICAL)\n\nBefore executing any commands on behalf of the user, you MUST adhere to the\nfollowing safety tiers based on the action requested:\n\n1.  **Tier R: Read-Only**\n    *   **Description:** Commands that only read state or query logs.\n    *   **Example commands:**\n        *   `gcloud logging read`\n        *   `gcloud logging buckets list`\n    *   **Rule:** No confirmation needed. You may execute these commands\n        immediately to gather information.\n2.  **Tier M: Mutation (Non-Billing)**\n    *   **Description:** Configuration modifications or free metadata creations\n        that do not incur direct storage or billing costs and do not affect\n        resource security\u002Faccess policies.\n    *   **Example commands:**\n        *   `gcloud logging views create`\n        *   `gcloud logging views update`\n        *   `gcloud logging scopes create`\n        *   `gcloud logging buckets create`\n    *   **Rule:** No confirmation needed. You may execute these commands\n        immediately to apply configurations.\n3.  **Tier B: Billing and Security-Sensitive Mutations (High-Risk)**\n    *   **Description:** Operations that create billing-inducing resources or\n        integrations, or modify security and IAM access control policies\n        (presenting a risk of privilege escalation).\n    *   **Example commands:**\n        *   `gcloud logging metrics create`\n        *   `gcloud logging links create`\n        *   `gcloud projects add-iam-policy-binding`\n    *   **Rule:** **Interactive confirmation required.** These commands create\n        resources that incur billing costs or alter security access. You MUST\n        present the exact, literal command and receive user confirmation before\n        executing. NEVER execute in the same turn as asking.\n4.  **Tier D: Causes irreversible data loss**\n    *   **Description:** Actions that permanently discard or delete logs, for\n        example sink exclusions.\n    *   **Example commands:**\n        *   `gcloud logging buckets delete`\n        *   `gcloud logging sinks update --add-exclusion`\n    *   **Rule:** **Explicit typed confirmation required.** These commands\n        discard or delete logs immediately and irreversibly, or they may result\n        in log data not being stored. You MUST ask for explicit typed\n        confirmation, for example, \"Yes, discard logs\", and halt execution until\n        the user replies.\n\n## Getting Started\n\nIf the `gcloud` executable is missing, refer to the\n[Google Cloud CLI Installation Guide](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk.md.txt)\nto install it.\n\n## Creating Log Buckets (Compliance and Analytics) (Tier M)\n\nTo create a regional log bucket with a specific retention policy for regulatory\ncompliance, and with Observability Analytics enabled:\n\n> [!WARNING] **Mandatory Observability Analytics Downgrade Warning:** Whenever\n> providing guidance, writing a guide, or drafting commands on Cloud Logging\n> cost optimization or exclusions, you **must** explicitly include the following\n> warning in your final text response and any generated guides: \"After a log\n> bucket has been upgraded to use Observability Analytics, it **cannot be\n> downgraded** to remove the analytics capability.\"\n\n```bash\ngcloud logging buckets create {bucket_id} \\\n    --project={project_id} \\\n    --location={region} \\\n    --retention-days={retention_days} \\\n    --enable-analytics\n```\n\n*   `{bucket_id}`: for example, `my-custom-bucket`\n*   `{region}`: for example, `global` or `us-central1`. Observability Analytics\n    is supported in both global and regional log buckets.\n*   `{retention_days}`: for example, `365`\n\nA log bucket incurs no storage or ingestion charges until logs are routed to it\nwith a log sink.\n\n### Verify the Log Bucket (Tier R)\n\nCheck the log bucket's configuration to verify its compliance:\n\n```bash\ngcloud logging buckets describe {bucket_id} \\\n    --location={region} \\\n    --project={project_id}\n```\n\n### Route logs to the Log Bucket (Tier B)\n\n> [!IMPORTANT] **Billing Action (Tier B):** Routing log entries to a bucket\n> incurs ongoing charges based on the volume of data stored. You MUST get\n> interactive user confirmation before running this command.\n\nLog entries are stored in the log bucket only if a log sink filter matches the\nentries and targets that bucket.\n\nTo route log entries to the log bucket:\n\n```bash\ngcloud logging sinks create {sink_id} \\\n    projects\u002F{project_id}\u002Flocations\u002F{region}\u002Fbuckets\u002F{bucket_id} \\\n    --log-filter='{filter_expression}' \\\n    --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## Logs-Based Metrics\n\nLogs-based metrics count the number of log entries that match a filter, allowing\nyou to track error rates and set up alerting policies.\n\n### 1. Create a logs-based counter metric (Tier B)\n\n> [!IMPORTANT] **Billing Action (Tier B):** Creating logs-based metrics incurs\n> ongoing charges based on the volume of data points reported. You MUST get\n> interactive user confirmation before running this command.\n\nTo count the occurrences of a specific log pattern, for example, \"OutOfMemory\"\nerrors:\n\n```bash\ngcloud logging metrics create {metric_name} \\\n    --log-filter='{filter_expression}' \\\n    --description='{description}' \\\n    --project={project_id}\n```\n\n*   `{metric_name}`: for example, `oom_error_count`\n*   `{filter_expression}`: for example, `textPayload:\"OutOfMemory\"`\n*   `{description}`: for example, \"Count of log entries about OOMs\"\n\nRefer to\n[REST Resource: projects.metric](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Freference\u002Fv2\u002Frest\u002Fv2\u002Fprojects.metrics.md.txt#LogMetric)\nfor restrictions on the metric fields.\n\n### 2. Verify the logs-based metric (Tier R)\n\nTo verify that the metric exists and inspect its configuration, use the\n`describe` command:\n\n```bash\ngcloud logging metrics describe {metric_name} \\\n    --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## Restricting Access to Sensitive Logs (Security)\n\nAnyone with `roles\u002Flogging.viewer` on that project can see logs in a project's\n`_Default` log bucket via `_Default` log view. To restrict visibility of the\nlogs:\n\n> [!IMPORTANT] **Ambiguity Handling (Guidance for Agents):** If the user asks to\n> \"exclude\", \"hide\", or \"remove\" sensitive logs without explicitly specifying\n> whether they want to stop storing them, you **MUST** default to **excluding\n> them from the default view (Step 1)**. This is a safe, non-destructive Tier M\n> action. Only configure a storage exclusion (under the \"Discarding Sensitive\n> Logs from Storage\" section) if the user explicitly uses destructive terms like\n> *\"stop storing\"*, *\"permanently discard\"*, or *\"sink exclusion\"*.\n\n### 1. Exclude sensitive logs from default view (Tier M)\n\nTo explicitly exclude sensitive logs from general access, update the filter for\nthe `_Default` log view:\n\n```bash\ngcloud logging views update _Default \\\n    --bucket=_Default \\\n    --location=global \\\n    --project={project_id} \\\n    --log-filter='NOT LOG_ID(\"cloudaudit.googleapis.com\u002Fdata_access\") AND NOT LOG_ID(\"externalaudit.googleapis.com\u002Fdata_access\") AND NOT LOG_ID(\"{sensitive_log_id}\")'\n```\n\n### 2. Create a log view (Tier M)\n\nCreate a new log view that includes the sensitive logs in the project's\n`_Default` log bucket. For example, a \"security-logs-view\" with access to the\n`{sensitive_log_id}`\n\n```bash\ngcloud logging views create security-logs-view \\\n    --bucket=_Default \\\n    --location=global \\\n    --project={project_id} \\\n    --log-filter='LOG_ID(\"{sensitive_log_id}\")' \\\n    --description=\"Sensitive logs\"\n```\n\n### 3. Grant access to log view using IAM conditions (Tier B)\n\n> [!IMPORTANT] **Security Action (Tier B):** Granting IAM permissions changes\n> access control policy and must be explicitly confirmed by the user before\n> execution.\n\nTo restrict access to log view use IAM. When granting the Logs Viewer Accessor\nrole, always attach an IAM condition that restricts the grant to a specific log\nview. For example, to grant `{security_group_email}` access ONLY to the\n`security-logs-view` in the `_Default` bucket:\n\n```bash\ngcloud projects add-iam-policy-binding {project_id} \\\n--member='group:{security_group_email}' \\\n--role='roles\u002Flogging.viewAccessor' \\\n--condition=\"expression=resource.name=='projects\u002F{project_id}\u002Flocations\u002Fglobal\u002Fbuckets\u002F_Default\u002Fviews\u002Fsecurity-logs-view',title=Restricted to Specific Log View,description=Only allows access to the specified log view\"\n```\n\nReplace `{location}` with the location of the log bucket, for example `global`\nor a regional location like `us-central1`.\n\n### 4. Verify Sensitive Log Restrictions (Tier R)\n\nTo verify that your Log View for sensitive logs is configured correctly:\n\n```bash\ngcloud logging views describe {view_id} \\\n    --bucket={bucket_id} \\\n    --location={region} \\\n    --project={project_id}\n```\n\nEnsure that the `filter` block contains the appropriate restriction expression.\n\n--------------------------------------------------------------------------------\n\n## Discarding Sensitive Logs from Storage (Tier D)\n\nIf your organization's compliance policies prohibit storing sensitive logs at\nall, you can configure an exclusion to discard them before they are written to\ndisk.\n\n> [!CAUTION] **Destructive Action (Tier D):** Excluding logs from all log sinks\n> deletes the log entries immediately and irreversibly.\n>\n> **Safety Rule:** You MUST ask the user for explicit typed confirmation, for\n> example, \"I confirm I want to exclude `{sensitive_log_id}` logs from storage\",\n> before running this command. **Same-Turn Restriction:** Do NOT execute the\n> `gcloud logging sinks update` command in the same turn as asking for\n> confirmation. Stop tool execution immediately and wait for the user to reply.\n\n**Exclude sensitive logs from storage using sink exclusions**\n\n```bash\ngcloud logging sinks update _Default \\\n    --project={project_id} \\\n    --add-exclusion=name=exclude-sensitive,filter='LOG_ID(\"{sensitive_log_id}\")'\n```\n\n--------------------------------------------------------------------------------\n\n## Cost Optimization (Reducing Logging Costs)\n\nCloud Logging costs are based on the volume of data ingested and stored. You can\nreduce costs by excluding high-volume, low-value logs or by sampling them. Each\nlog sink that routes logs to a distinct log bucket contributes to cost and is a\ncandidate for optimization.\n\n> [!CAUTION] **Destructive Actions (Tier D):** Exclusions in this section may\n> immediately halt storage of log entries.\n>\n> **Safety Rule:** You MUST ask for explicit typed confirmation (for example, \"I\n> confirm I want to exclude load balancer logs\") before executing exclusions or\n> sampling updates.\n\n### Exclude all high-volume logs (Tier D)\n\nTo completely stop ingesting a specific type of log into a log bucket, add an\nexclusion to the log sinks that route logs into that bucket.\n\n```bash\ngcloud logging sinks update {sink_id} \\\n    --project={project_id} \\\n    --add-exclusion=name={exclusion_name},filter={exclusion_filter}\n```\n\n*   `{sink_id}`: for example '_Default'\n*   `{exclusion_name}`: for example 'exclude-lb-logs'\n*   `{exclusion_filter}`: for example 'resource.type=\"http_load_balancer\"'\n\n### Sample high-volume logs (Tier D)\n\nIf you need some logs for analysis but want to reduce volume, use the `sample()`\nfunction in the exclusion filter.\n\n> [!IMPORTANT] The `sample(field, fraction)` function matches a `fraction` of\n> logs. When used in an **exclusion filter**, the matched logs are\n> **discarded**. If you exclude 90% of log entries, then only 10% are retained.\n> To exclude 90%, use `sample(insertId, 0.9)` in the exclusion filter.\n\nTo exclude 90% of `DEBUG` severity logs:\n\n```bash\ngcloud logging sinks update _Default \\\n    --project={project_id} \\\n    --add-exclusion=name=sample-debug-logs,filter='severity=DEBUG AND sample(insertId, 0.9)'\n```\n\n### Verify Log Exclusions and Cost Optimization (Tier R)\n\nTo verify that log exclusions are correct, list the details of the sink and\ncheck the `exclusions` to ensure your filter is present. For example, for the\n`_Default` sink:\n\n```bash\ngcloud logging sinks describe _Default --project={project_id}\n```\n\n--------------------------------------------------------------------------------\n\n## References and Supporting Links\n\n*   [Cloud Logging - Counter Metrics](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Flogs-based-metrics\u002Fcounter-metrics.md.txt)\n*   [Cloud Logging - Custom Log Views](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Flogs-views.md.txt)\n*   [Cloud Logging - Exclusions](https:\u002F\u002Fdocs.cloud.google.com\u002Flogging\u002Fdocs\u002Frouting\u002Foverview.md.txt)\n",{"name":5,"metadata":56,"description":7},{"version":57,"category":58},"1.0.3","CloudObservabilityAndMonitoring","main","64d010629e61e4a7d59fc21e042362f370b5888b","skills\u002Fcloud\u002Fcloud-logging-configuration-basics",2014,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 23:31:00",{"source":9,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add google\u002Fskills --skill cloud-logging-configuration-basics",{"tool":74,"command":75},"bunx","bunx skills add google\u002Fskills --skill cloud-logging-configuration-basics",{"tool":77,"command":78},"pnpm","pnpm dlx skills add google\u002Fskills --skill cloud-logging-configuration-basics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-logging-configuration-basics\u002FSKILL.md",true,[82],{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fattribution.md","REFERENCE","参考文档",1942,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-logging-configuration-basics\u002Freferences\u002Fattribution.md",[89,97,104,111,118,125],{"skillNo":90,"name":91,"nameZh":17,"description":92,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":96},"01M7DQ9K7JF4T7NJZ2K1MQZ44Q","cloud-operator-share-context","Shares Google Cloud operating context the user or their team already have — environments, projects, services and regions, product preferences, best practices, architecture guidance, runbooks — found in agent instruction files, local memory, skills and workflows, and the repository's GCP docs, with the operator agent's memory after the user reviews the list. Use when the user runs this skill, accepts the cloud-operator or cloud-operator-setup skill's offer to share their existing Google Cloud context, or asks to share, import or save that context or a GCP fact for the operator agent. Don't use for ordinary GCP requests, which go to the cloud-operator skill.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-share-context\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":98,"name":99,"nameZh":17,"description":100,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":96},"01M7DQ9ERFGGQCFAWQW0KRKYBY","cloud-operator-setup","Sets up the operator agent in a Google Cloud project via the autocloud MCP server: picks the operator project, creates or checks the user's operator agent, saves the project, and offers to share the user's existing Google Cloud operating context with the operator agent's memory. Use when the user runs this skill, asks to set up the operator or create their operator agent, or chooses setup when the cloud-operator skill asks. Don't use for ordinary GCP requests or installing gcloud.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-setup\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":17,"description":107,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":96},"01M7B4RHQCM0DK2XQ7S7ZXVN8D","developer-device-platform-device-run","Runs automated, non-interactive jobs on remote Android devices with Developer Device Platform (DDP) Device Run using `gcloud beta device-run sessions`: native Android executables or shell scripts (for example CLI tools, custom runners, test harnesses or benchmarks) and Android instrumentation tests, on one or many devices, then waits for completion and collects per-device outputs and logs. Use when running a binary or test suite on remote devices without an interactive connection. Don't use it for interactive device reservations, adb tunnels or screen streaming (use developer-device-platform-basics), or for local devices.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fdeveloper-device-platform-device-run\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":17,"description":114,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":96},"01M7B4R9YXMRW7RZP9Q9FMZJ2P","compute-vm-creation","Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcompute-vm-creation\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":17,"description":121,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":96},"01M7B4QD02N0YBVT0838Z5K5VC","agent-platform-autorater-customization","Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent wrong, or wants an autorater to agree with human labels (autorater hillclimbing, judge calibration). Don't use for quick evals with built-in metrics or for improving the agent itself (use agent-platform-eval-flywheel).","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fagent-platform-autorater-customization\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":17,"description":128,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":96},"01M78JP22K73KK96JH0JNDT5C4","iap-agent-platform-troubleshooting","Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests from Gemini Enterprise Agent Platform agents that run on Agent Runtime and send traffic through Agent Gateway. Use when an agent request fails with \"Egress request is not authorized\", when Cloud Audit Logs show an IAP egressViaIAP decision with granted false, when IAP audit entries are missing while debugging agent egress, or when Access policies, IAP allow policies, policy bindings, or Agent Registry entries might block agent egress. Don't use for Gemini model IAM permission errors (such as aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime deployment or 500 errors (use agent-platform-troubleshooting instead). Don't use for setting up, creating, or connecting an Agent Gateway, or for IAP web apps, IAP TCP forwarding, or SSH.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fiap-agent-platform-troubleshooting\u002FSKILL.md",[],[]]