gcloud logging buckets create BUCKET_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 …]
gcloud logging buckets create my-bucket --location=global --description="my custom bucket"To create a bucket with extended retention, run:
gcloud logging buckets create my-bucket --location=global --retention-days=365To create a bucket in cloud region 'us-central1', run:
gcloud logging buckets create my-bucket --location=us-central1To create a bucket with custom index of 'jsonPayload.foo', run:
gcloud logging buckets create my-bucket --index=fieldPath=jsonPayload.foo,type=INDEX_TYPE_STRINGTo create a bucket with custom CMEK, run:
gcloud logging buckets create my-bucket --location=us-central1 --cmek-kms-key-name=CMEK_KMS_KEY_NAMETo asynchronously create a bucket enrolled into Log Analytics, run:
gcloud logging buckets create my-bucket --location=global --async --enable-analyticsBUCKET_ID--location=LOCATION--async--cmek-kms-key-name=CMEK_KMS_KEY_NAMEkms_key_name will enable CMEK for the bucket.
--description=DESCRIPTION--enable-analytics--index=[KEY=VALUE, …,…]fieldPath and
type attributes are required. For example:
--index=fieldPath=jsonPayload.foo,type=INDEX_TYPE_STRING. The following keys are
accepted:
fieldPathtype--restricted-fields=[RESTRICTED_FIELD,…]--retention-days=RETENTION_DAYS--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.
gcloud alpha logging buckets creategcloud beta logging buckets create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.