gcloud alpha logging buckets create

NAME
gcloud alpha logging buckets create - create a bucket
SYNOPSIS
gcloud alpha logging buckets createBUCKET_ID--location=LOCATION[--async][--cmek-kms-key-name=CMEK_KMS_KEY_NAME][--description=DESCRIPTION][--enable-analytics][--index=[KEY=VALUE, …,…]][--restricted-fields=[RESTRICTED_FIELD,…]][--retention-days=RETENTION_DAYS][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) After creating a bucket, use a log sink to route logs intothe bucket.
EXAMPLES
To create a bucket 'my-bucket' in location 'global', run:
gcloudalphaloggingbucketscreatemy-bucket--location=global--description="my custom bucket"

To create a bucket with extended retention, run:

gcloudalphaloggingbucketscreatemy-bucket--location=global--retention-days=365

To create a bucket in cloud region 'us-central1', run:

gcloudalphaloggingbucketscreatemy-bucket--location=us-central1

To create a bucket with custom index of 'jsonPayload.foo', run:

gcloudalphaloggingbucketscreatemy-bucket--index=fieldPath=jsonPayload.foo,type=INDEX_TYPE_STRING

To create a bucket with custom CMEK, run:

gcloudalphaloggingbucketscreatemy-bucket--location=us-central1--cmek-kms-key-name=CMEK_KMS_KEY_NAME

To asynchronously create a bucket enrolled into Log Analytics, run:

gcloudalphaloggingbucketscreatemy-bucket--location=global--async--enable-analytics
POSITIONAL ARGUMENTS
BUCKET_ID
ID of the bucket to create.
REQUIRED FLAGS
--location=LOCATION
Location in which to create the bucket. Once the bucket is created, the locationcannot be changed.
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--cmek-kms-key-name=CMEK_KMS_KEY_NAME
A validkms_key_name will enable CMEK for the bucket.
--description=DESCRIPTION
A textual description for the bucket.
--enable-analytics
Whether to opt the bucket into Log Analytics. Once opted in, the bucket cannotbe opted out of Log Analytics.
--index=[KEY=VALUE, …,…]
Specify an index to be added to the log bucket. This flag can be repeated. ThefieldPath andtype attributes are required. For example:--index=fieldPath=jsonPayload.foo,type=INDEX_TYPE_STRING. The following keys areaccepted:
fieldPath
The LogEntry field path to index. For example: jsonPayload.request.status. Pathsare limited to 800 characters and can include only letters, digits, underscores,hyphens, and periods.
type
The type of data in this index. For example: INDEX_TYPE_STRING Supported typesare INDEX_TYPE_STRING and INDEX_TYPE_INTEGER.
--restricted-fields=[RESTRICTED_FIELD,…]
Comma-separated list of field paths that require permission checks in thisbucket. The following fields and their children are eligible: textPayload,jsonPayload, protoPayload, httpRequest, labels, sourceLocation.
--retention-days=RETENTION_DAYS
The period logs will be retained, after which logs will automatically bedeleted. The default is 30 days.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudloggingbucketscreate
gcloudbetaloggingbucketscreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.