Skip to main content

buckets

Creates, updates, deletes, gets or lists a buckets resource.

Overview

Namebuckets
TypeResource
Idgoogle.logging.buckets

Fields

NameDatatypeDescription
namestringOutput only. The resource name of the bucket.For example:projects/my-project/locations/global/buckets/my-bucketFor a list of supported locations, see Supported Regions (https://cloud.google.com/logging/docs/region-support)For the location of global it is unspecified where log entries are actually stored.After a bucket has been created, the location cannot be changed.
descriptionstringOptional. Describes this bucket.
analyticsEnabledbooleanOptional. Whether log analytics is enabled for this bucket.Once enabled, log analytics features cannot be disabled.
cmekSettingsobjectDescribes the customer-managed encryption key (CMEK) settings associated with a project, folder, organization, billing account, or flexible resource.Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization.See Enabling CMEK for Log Router (https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
createTimestringOutput only. The creation timestamp of the bucket. This is not set for any of the default buckets.
indexConfigsarrayOptional. A list of indexed fields and related configuration data.
lifecycleStatestringOutput only. The bucket lifecycle state.
lockedbooleanOptional. Whether the bucket is locked.The retention period on a locked bucket cannot be changed. Locked buckets may only be deleted if they are empty.
restrictedFieldsarrayOptional. Log entry field paths that are denied access in this bucket.The following fields and their children are eligible: textPayload, jsonPayload, protoPayload, httpRequest, labels, sourceLocation.Restricting a repeated field will restrict all values. Adding a parent will block all child fields. (e.g. foo.bar will block foo.bar.baz)
retentionDaysintegerOptional. Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used.
updateTimestringOutput only. The last update timestamp of the bucket.

Methods

NameAccessible byRequired ParamsDescription
billing_accounts_locations_buckets_getSELECTbillingAccountsId, bucketsId, locationsIdGets a log bucket.
billing_accounts_locations_buckets_listSELECTbillingAccountsId, locationsIdLists log buckets.
folders_locations_buckets_getSELECTbucketsId, foldersId, locationsIdGets a log bucket.
folders_locations_buckets_listSELECTfoldersId, locationsIdLists log buckets.
locations_buckets_listSELECTparent, parentTypeLists log buckets.
organizations_locations_buckets_getSELECTbucketsId, locationsId, organizationsIdGets a log bucket.
organizations_locations_buckets_listSELECTlocationsId, organizationsIdLists log buckets.
projects_locations_buckets_getSELECTbucketsId, locationsId, projectsIdGets a log bucket.
projects_locations_buckets_listSELECTlocationsId, projectsIdLists log buckets.
billing_accounts_locations_buckets_createINSERTbillingAccountsId, locationsIdCreates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.
folders_locations_buckets_createINSERTfoldersId, locationsIdCreates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.
locations_buckets_createINSERTparent, parentTypeCreates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.
organizations_locations_buckets_createINSERTlocationsId, organizationsIdCreates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.
projects_locations_buckets_createINSERTlocationsId, projectsIdCreates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.
billing_accounts_locations_buckets_deleteDELETEbillingAccountsId, bucketsId, locationsIdDeletes a log bucket.Changes the bucket's lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.
folders_locations_buckets_deleteDELETEbucketsId, foldersId, locationsIdDeletes a log bucket.Changes the bucket's lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.
organizations_locations_buckets_deleteDELETEbucketsId, locationsId, organizationsIdDeletes a log bucket.Changes the bucket's lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.
projects_locations_buckets_deleteDELETEbucketsId, locationsId, projectsIdDeletes a log bucket.Changes the bucket's lifecycle_state to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.
billing_accounts_locations_buckets_patchUPDATEbillingAccountsId, bucketsId, locationsIdUpdates a log bucket.If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.After a bucket has been created, the bucket's location cannot be changed.
folders_locations_buckets_patchUPDATEbucketsId, foldersId, locationsIdUpdates a log bucket.If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.After a bucket has been created, the bucket's location cannot be changed.
organizations_locations_buckets_patchUPDATEbucketsId, locationsId, organizationsIdUpdates a log bucket.If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.After a bucket has been created, the bucket's location cannot be changed.
projects_locations_buckets_patchUPDATEbucketsId, locationsId, projectsIdUpdates a log bucket.If the bucket has a lifecycle_state of DELETE_REQUESTED, then FAILED_PRECONDITION will be returned.After a bucket has been created, the bucket's location cannot be changed.
billing_accounts_locations_buckets_undeleteEXECbillingAccountsId, bucketsId, locationsIdUndeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.
folders_locations_buckets_undeleteEXECbucketsId, foldersId, locationsIdUndeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.
locations_buckets_undeleteEXECnameUndeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.
organizations_locations_buckets_undeleteEXECbucketsId, locationsId, organizationsIdUndeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.
projects_locations_buckets_undeleteEXECbucketsId, locationsId, projectsIdUndeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.

SELECT examples

Lists log buckets.

SELECT
name,
description,
analyticsEnabled,
cmekSettings,
createTime,
indexConfigs,
lifecycleState,
locked,
restrictedFields,
retentionDays,
updateTime
FROM google.logging.buckets
WHERE parent = '{{ parent }}'
AND parentType = '{{ parentType }}';

INSERT example

Use the following StackQL query and manifest file to create a new buckets resource.

/*+ create */
INSERT INTO google.logging.buckets (
parent,
parentType,
description,
retentionDays,
locked,
analyticsEnabled,
restrictedFields,
indexConfigs,
cmekSettings
)
SELECT
'{{ parent }}',
'{{ parentType }}',
'{{ description }}',
'{{ retentionDays }}',
{{ locked }},
{{ analyticsEnabled }},
'{{ restrictedFields }}',
'{{ indexConfigs }}',
'{{ cmekSettings }}'
;

UPDATE example

Updates a buckets resource.

/*+ update */
UPDATE google.logging.buckets
SET
description = '{{ description }}',
retentionDays = '{{ retentionDays }}',
locked = true|false,
analyticsEnabled = true|false,
restrictedFields = '{{ restrictedFields }}',
indexConfigs = '{{ indexConfigs }}',
cmekSettings = '{{ cmekSettings }}'
WHERE
bucketsId = '{{ bucketsId }}'
AND foldersId = '{{ foldersId }}'
AND locationsId = '{{ locationsId }}';

DELETE example

Deletes the specified buckets resource.

/*+ delete */
DELETE FROM google.logging.buckets
WHERE bucketsId = '{{ bucketsId }}'
AND foldersId = '{{ foldersId }}'
AND locationsId = '{{ locationsId }}';