Reference documentation and code samples for the Stackdriver Logging V2 Client class LogExclusion.
Specifies a set of log entries that are filtered out by a sink. If
your Google Cloud resource receives a large volume of log entries, you can
use exclusions to reduce your chargeable logs. Note that exclusions on
organization-level and folder-level sinks don't apply to child resources.
Note also that you cannot modify the _Required sink or exclude logs from it.
Generated from protobuf messagegoogle.logging.v2.LogExclusion
Namespace
Google \ Cloud \ Logging \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Required. A client-assigned identifier, such as"load-balancer-exclusion". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods. First character has to be alphanumeric.
↳ description
string
Optional. A description of this exclusion.
↳ filter
string
Required. Anadvanced logs filterthat matches the log entries to be excluded. By using thesample function, you can exclude less than 100% of the matching log entries. For example, the following query matches 99% of low-severity log entries from Google Cloud Storage buckets:resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)
↳ disabled
bool
Optional. If set to True, then this exclusion is disabled and it does not exclude any log entries. You canupdate an exclusionto change the value of this field.
Output only. The last update timestamp of the exclusion. This field may not be present for older exclusions.
getName
Required. A client-assigned identifier, such as"load-balancer-exclusion". Identifiers are limited to 100 characters and
can include only letters, digits, underscores, hyphens, and periods. First
character has to be alphanumeric.
Returns
Type
Description
string
setName
Required. A client-assigned identifier, such as"load-balancer-exclusion". Identifiers are limited to 100 characters and
can include only letters, digits, underscores, hyphens, and periods. First
character has to be alphanumeric.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDescription
Optional. A description of this exclusion.
Returns
Type
Description
string
setDescription
Optional. A description of this exclusion.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getFilter
Required. Anadvanced logs
filterthat
matches the log entries to be excluded. By using thesample
function,
you can exclude less than 100% of the matching log entries.
For example, the following query matches 99% of low-severity log entries
from Google Cloud Storage buckets:resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)
Returns
Type
Description
string
setFilter
Required. Anadvanced logs
filterthat
matches the log entries to be excluded. By using thesample
function,
you can exclude less than 100% of the matching log entries.
For example, the following query matches 99% of low-severity log entries
from Google Cloud Storage buckets:resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDisabled
Optional. If set to True, then this exclusion is disabled and it does not
exclude any log entries. You canupdate an
exclusionto change the
value of this field.
Returns
Type
Description
bool
setDisabled
Optional. If set to True, then this exclusion is disabled and it does not
exclude any log entries. You canupdate an
exclusionto change the
value of this field.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getCreateTime
Output only. The creation timestamp of the exclusion.
This field may not be present for older exclusions.
[[["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-09-04 UTC."],[],[],null,["# Stackdriver Logging V2 Client - Class LogExclusion (1.32.3)\n\nVersion latestkeyboard_arrow_down\n\n- [1.32.3 (latest)](/php/docs/reference/cloud-logging/latest/V2.LogExclusion)\n- [1.32.2](/php/docs/reference/cloud-logging/1.32.2/V2.LogExclusion)\n- [1.31.3](/php/docs/reference/cloud-logging/1.31.3/V2.LogExclusion)\n- [1.30.3](/php/docs/reference/cloud-logging/1.30.3/V2.LogExclusion)\n- [1.29.0](/php/docs/reference/cloud-logging/1.29.0/V2.LogExclusion)\n- [1.28.5](/php/docs/reference/cloud-logging/1.28.5/V2.LogExclusion)\n- [1.27.1](/php/docs/reference/cloud-logging/1.27.1/V2.LogExclusion)\n- [1.26.0](/php/docs/reference/cloud-logging/1.26.0/V2.LogExclusion)\n- [1.25.5](/php/docs/reference/cloud-logging/1.25.5/V2.LogExclusion)\n- [1.24.10](/php/docs/reference/cloud-logging/1.24.10/V2.LogExclusion) \nReference documentation and code samples for the Stackdriver Logging V2 Client class LogExclusion.\n\nSpecifies a set of log entries that are filtered out by a sink. If\nyour Google Cloud resource receives a large volume of log entries, you can\nuse exclusions to reduce your chargeable logs. Note that exclusions on\norganization-level and folder-level sinks don't apply to child resources.\n\nNote also that you cannot modify the _Required sink or exclude logs from it.\n\nGenerated from protobuf message `google.logging.v2.LogExclusion`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Logging \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nRequired. A client-assigned identifier, such as\n`\"load-balancer-exclusion\"`. Identifiers are limited to 100 characters and\ncan include only letters, digits, underscores, hyphens, and periods. First\ncharacter has to be alphanumeric.\n\n### setName\n\nRequired. A client-assigned identifier, such as\n`\"load-balancer-exclusion\"`. Identifiers are limited to 100 characters and\ncan include only letters, digits, underscores, hyphens, and periods. First\ncharacter has to be alphanumeric.\n\n### getDescription\n\nOptional. A description of this exclusion.\n\n### setDescription\n\nOptional. A description of this exclusion.\n\n### getFilter\n\nRequired. An [advanced logs\nfilter](https://cloud.google.com/logging/docs/view/advanced-queries) that\nmatches the log entries to be excluded. By using the [sample\nfunction](https://cloud.google.com/logging/docs/view/advanced-queries#sample),\nyou can exclude less than 100% of the matching log entries.\n\nFor example, the following query matches 99% of low-severity log entries\nfrom Google Cloud Storage buckets:\n`resource.type=gcs_bucket severity\u003cERROR sample(insertId, 0.99)`\n\n### setFilter\n\nRequired. An [advanced logs\nfilter](https://cloud.google.com/logging/docs/view/advanced-queries) that\nmatches the log entries to be excluded. By using the [sample\nfunction](https://cloud.google.com/logging/docs/view/advanced-queries#sample),\nyou can exclude less than 100% of the matching log entries.\n\nFor example, the following query matches 99% of low-severity log entries\nfrom Google Cloud Storage buckets:\n`resource.type=gcs_bucket severity\u003cERROR sample(insertId, 0.99)`\n\n### getDisabled\n\nOptional. If set to True, then this exclusion is disabled and it does not\nexclude any log entries. You can update an exclusion to change the\nvalue of this field.\n\n### setDisabled\n\nOptional. If set to True, then this exclusion is disabled and it does not\nexclude any log entries. You can update an exclusion to change the\nvalue of this field.\n\n### getCreateTime\n\nOutput only. The creation timestamp of the exclusion.\n\nThis field may not be present for older exclusions.\n\n### hasCreateTime\n\n### clearCreateTime\n\n### setCreateTime\n\nOutput only. The creation timestamp of the exclusion.\n\nThis field may not be present for older exclusions.\n\n### getUpdateTime\n\nOutput only. The last update timestamp of the exclusion.\n\nThis field may not be present for older exclusions.\n\n### hasUpdateTime\n\n### clearUpdateTime\n\n### setUpdateTime\n\nOutput only. The last update timestamp of the exclusion.\n\nThis field may not be present for older exclusions."]]