[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-13 UTC。"],[],[],null,["# Control log ingestion\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\n[Exclusion filters](/logging/docs/routing/overview#exclusions) let you\ncontrol the volume of Google Kubernetes Engine (GKE) logs ingested by Cloud Logging while\nstill making verbose logging available for debugging. You can use exclusion\nfilters to exclude matching log entries from being ingested\nby Cloud Logging or from being routed to the destination of a\n[sink](/logging/docs/routing/overview#sinks).\n\nCreate exclusion filters by using the [Logging query language](/logging/docs/view/logging-query-language).\n\nLog entries are excluded after they are received by the\nLogging API and therefore these log entries consume\n[`entries.write` API quota](/logging/quotas#api-limits). You can't reduce\nthe number of [`entries.write` API calls](/logging/quotas#log-limits) by\nexcluding log entries.\n\nExcluded log entries aren't available in the Logs Explorer or in\nError Reporting.\n\nFor information about viewing ingestion data, see\n[View detailed usage in Metrics Explorer](/stackdriver/estimating-bills#metric-exp-usage).\n\nBefore you begin\n----------------\n\nBefore you start, make sure that you have performed the following tasks:\n\n- Enable the Google Kubernetes Engine API.\n[Enable Google Kubernetes Engine API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n- If you want to use the Google Cloud CLI for this task, [install](/sdk/docs/install) and then [initialize](/sdk/docs/initializing) the gcloud CLI. If you previously installed the gcloud CLI, get the latest version by running `gcloud components update`. **Note:** For existing gcloud CLI installations, make sure to set the `compute/region` [property](/sdk/docs/properties#setting_properties). If you use primarily zonal clusters, set the `compute/zone` instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: `One of [--zone, --region] must be supplied: Please specify location`. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.\n\n\u003c!-- --\u003e\n\n- Verify that you have a Google Cloud project with logs that you can see in the [Logs Explorer](/logging/docs/view/logs-explorer-summary).\n\n### Permissions\n\nVerify that you have one of the following IAM roles for the\nsource Google Cloud project from which you're routing logs.\n\n- **Owner** (`roles/owner`)\n- **Logging Admin** (`roles/logging.admin`)\n- **Logs Configuration Writer** (`roles/logging.configWriter`)\n\nThe permissions contained in these roles let you create, delete, or\nmodify sinks. For information on setting IAM roles, see the\nLogging [Access control guide](/logging/docs/access-control).\n\nAdd an exclusion filter\n-----------------------\n\nThe following steps describe how to add a Cloud Logging exclusion filter\nthat excludes logs from ingestion into the `Default` Cloud Logging bucket.\n\n1. In the Google Cloud console, go to the **Logs Router** page:\n\n [Go to Logs Router](https://console.cloud.google.com/logs/router)\n2. Find the row with the `_Default` sink, expand the\n more_vert\n **Actions** option, and then click **Edit sink**.\n\n3. In **Choose logs to filter out of sink** , for **Build an exclusion filter** ,\n click add **Add exclusion**.\n\n4. Enter a name for your exclusion filter.\n\n5. In the **Build an exclusion filter** section, enter the filter criteria.\n For example, you can exclude log entries for a cluster, or specific log\n entries for a container.\n\n Exclude all log entries from a specific cluster: \n\n resource.labels.cluster_name=\"\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\"\n\n Exclude log entries with the [log severity](/logging/docs/reference/v2/rest/v2/LogEntry#logseverity)\n `DEFAULT`, `DEBUG`, `INFO`, or `NOTICE` for a specific container in\n a specific cluster: \n\n resource.type=\"k8s_container\"\n resource.labels.container_name=\"\u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e\"\n resource.labels.cluster_name=\"\u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e\"\n severity=(DEFAULT OR DEBUG OR INFO OR NOTICE)\n\n6. Click **Update sink**.\n\nThe `_Default` sink is now configured to exclude logs with the filter you added.\n\nWhat's next\n-----------\n\n- Learn more about [exclusion filters](/logging/docs/routing/overview#exclusions)."]]