gcloud alpha logging metrics update Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha logging metrics update - update the definition of a logs-based metric
- SYNOPSIS
gcloud alpha logging metrics updateMETRIC_NAME(--config-from-file=PATH_TO_FILE|--bucket-name=BUCKET_NAME--description=DESCRIPTION--log-filter=LOG_FILTER)[GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)Update the description or the filter expression of anexisting logs-based metric.- EXAMPLES
- To update the description of a metric called high_severity_count, run:
gcloudalphaloggingmetricsupdatehigh_severity_count--description="Count of high-severity log entries."To update the filter expression of the metric, run:
gcloudalphaloggingmetricsupdatehigh_severity_count--log-filter="severity >= WARNING"Detailed information about filters can be found at:https://cloud.google.com/logging/docs/view/logging-query-language
For advanced features such as user-defined labels and distribution metrics,update using a config file:
gcloudalphaloggingmetricsupdatehigh_severity_count--config-from-file=$PATH_TO_FILEThe config file should be in YAML format. Detailed information about how toconfigure metrics can be found at:https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.Any top-level fields in the LogMetric definition that aren't specified in theconfig file will not be updated in the metric.
To update the bucket associated with a bucket log-based metric, run:
gcloudalphaloggingmetricsupdatemy-bucket-metric--bucket-name="NEW_BUCKET_NAME" - POSITIONAL ARGUMENTS
METRIC_NAME- The name of the log-based metric to update.
- REQUIRED FLAGS
- Data about the metric to update.
Exactly one of these must be specified:
--config-from-file=PATH_TO_FILE- A path to a YAML file specifying the updates to be made to the logs-basedmetric. Use a full or relative path to a local file containing the value ofconfig.
- Or at least one of these can be specified:
- Arguments to specify information about simple counter logs-based metrics.
--bucket-name=BUCKET_NAME- The Log Bucket name which owns the log-based metric.
--description=DESCRIPTION- A new description for the metric. If omitted, the description is not changed.
--log-filter=LOG_FILTER- A new filter string for the metric. If omitted, the filter is not changed.
- Data about the metric to update.
- 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:
gcloudloggingmetricsupdategcloudbetaloggingmetricsupdate
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.