Exclusion filters let you
control the volume of Google Kubernetes Engine (GKE) logs ingested by Cloud Logging while
still making verbose logging available for debugging. You can use exclusion
filters to exclude matching log entries from being ingested
by Cloud Logging or from being routed to the destination of a
sink.
Log entries are excluded after they are received by the
Logging API and therefore these log entries consume
entries.write API quota. You can't reduce
the number of entries.write API calls by
excluding log entries.
Excluded log entries aren't available in the Logs Explorer or in
Error Reporting.
If you want to use the Google Cloud CLI for this task,
install and then
initialize the
gcloud CLI. If you previously installed the gcloud CLI, get the latest
version by running gcloud components update.
Verify that you have a Google Cloud project with logs that you can see in the
Logs Explorer.
Permissions
Verify that you have one of the following IAM roles for the
source Google Cloud project from which you're routing logs.
The permissions contained in these roles let you create, delete, or
modify sinks. For information on setting IAM roles, see the
Logging Access control guide.
Add an exclusion filter
The following steps describe how to add a Cloud Logging exclusion filter
that excludes logs from ingestion into the Default Cloud Logging bucket.
In the Google Cloud console, go to the Logs Router page:
Find the row with the _Default sink, expand the
more_vertActions option, and then click Edit sink.
In Choose logs to filter out of sink, for Build an exclusion filter,
click addAdd exclusion.
Enter a name for your exclusion filter.
In the Build an exclusion filter section, enter the filter criteria.
For example, you can exclude log entries for a cluster, or specific log
entries for a container.
Exclude all log entries from a specific cluster:
resource.labels.cluster_name="CLUSTER_NAME"
Exclude log entries with the log severityDEFAULT, DEBUG, INFO, or NOTICE for a specific container in
a specific cluster:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 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)."]]