gcloud alpha logging sinks create Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha logging sinks create - create a log sink
- SYNOPSIS
gcloud alpha logging sinks createSINK_NAMEDESTINATION[--custom-writer-identity=SERVICE_ACCOUNT_EMAIL][--description=DESCRIPTION][--disabled][--exclusion=[description=DESCRIPTION],[disabled=DISABLED],[filter=FILTER],[name=NAME]][--include-children][--intercept-children][--log-filter=LOG_FILTER][--use-partitioned-tables][--billing-account=BILLING_ACCOUNT_ID|--folder=FOLDER_ID|--organization=ORGANIZATION_ID|--project=PROJECT_ID][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)Create a log sink used to route log entries to adestination. The sink routes all log entries that match its--log-filterflag.An empty filter matches all logs.
Detailed information about filters can be found at:https://cloud.google.com/logging/docs/view/logging-query-language
The sink's destination can be a Cloud Logging log bucket, a Cloud Storagebucket, a BigQuery dataset, a Cloud Pub/Sub topic, or a Google Cloud project.
The destination must already exist.
If creating a log sink to route logs to a destination outside of Cloud Loggingor to a Cloud Logging log bucket in another project, the log sink's serviceaccount must be granted permission to write to the destination.
For more information about destination permissions, see:https://cloud.google.com/logging/docs/export/configure_export_v2#dest-auth
Matching log entries are routed to the destination after the sink is created.
- EXAMPLES
- To route all Google Compute Engine logs to BigQuery, run:
gcloudalphaloggingsinkscreatemy-bq-sinkbigquery.googleapis.com/projects/my-project/datasets/my_dataset--log-filter='resource.type="gce_instance"'To route "syslog" from App Engine Flexible to a Cloud Storage bucket, run:
gcloudalphaloggingsinkscreatemy-gcs-sinkstorage.googleapis.com/my-bucket--log-filter='logName="projects/my-project/appengine.googleapis.com%2Fsyslog"'To route Google App Engine logs with ERROR severity, run:
gcloudalphaloggingsinkscreatemy-error-logsbigquery.googleapis.com/projects/my-project/datasets/my_dataset--log-filter='resource.type="gae_app" AND severity=ERROR'To route all logs to a log bucket in a different project, run:
gcloudalphaloggingsinkscreatemy-sinklogging.googleapis.com/projects/my-central-project/locations/global/buckets/my-central-bucketTo route all logs to another project, run:
gcloudalphaloggingsinkscreatemy-sinklogging.googleapis.com/projects/my-destination-project - POSITIONAL ARGUMENTS
SINK_NAME- The name for the sink.
DESTINATION- The destination for the sink.
- FLAGS
--custom-writer-identity=SERVICE_ACCOUNT_EMAIL- Writer identity for the sink. This flag can only be used if the destination is alog bucket in a different project. The writer identity is automaticallygenerated when it is not provided for a sink.
--description=DESCRIPTION- Description of the sink.
--disabled- Sink will be disabled. Disabled sinks do not export logs.
--exclusion=[description=DESCRIPTION],[disabled=DISABLED],[filter=FILTER],[name=NAME]- Specify an exclusion filter for a log entry that is not to be exported. Thisflag can be repeated.
The
andnameattributes are required. Thefollowing keys are accepted:filtername- An identifier, such as
. Identifiers arelimited to 100 characters and can include only letters, digits, underscores,hyphens, and periods.load-balancer-exclusion description- A description of this exclusion.
filter- An advanced log filter that matches the log entries to be excluded.
disabled- If this exclusion should be disabled and not exclude the log entries.
--include-children- Whether to export logs from all child projects and folders. Only applies tosinks for organizations and folders.
--intercept-children- Whether to intercept logs from all child projects and folders. Only applies tosinks for organizations and folders.
--log-filter=LOG_FILTER- A filter expression for the sink. If present, the filter specifies which logentries to export.
- Settings for sink exporting data to BigQuery.
--use-partitioned-tables- If specified, use BigQuery's partitioned tables. By default, Logging createsdated tables based on the log entries' timestamps, e.g. 'syslog_20170523'.Partitioned tables remove the suffix and special query syntax(https://cloud.google.com/bigquery/docs/querying-partitioned-tables) must beused.
- At most one of these can be specified:
--billing-account=BILLING_ACCOUNT_ID- Billing account of the sink to create.
--folder=FOLDER_ID- Folder of the sink to create.
--organization=ORGANIZATION_ID- Organization of the sink to create.
--project=PROJECT_ID- Project of the sink to create.
The Google Cloud project ID to use for this invocation. If omitted, then thecurrent project is assumed; the current project can be listed using
gcloudconfig list --format='text(core.project)'and can be set usinggcloud config set project PROJECTID.--projectand its fallbackcore/projectproperty playtwo roles in the invocation. It specifies the project of the resource to operateon. It also specifies the project for API enablement check, quota, and billing.To specify a different project for quota and billing, use--billing-projectorbilling/quota_projectproperty.
- 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 helpfor 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:
gcloudloggingsinkscreategcloudbetaloggingsinkscreate
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 2026-01-21 UTC.