gcloud logging metrics update METRIC_NAME (--config-from-file=PATH_TO_FILE | --bucket-name=BUCKET_NAME --description=DESCRIPTION --log-filter=LOG_FILTER) [GCLOUD_WIDE_FLAG …]
gcloud logging metrics update high_severity_count --description="Count of high-severity log entries."To update the filter expression of the metric, run:
gcloud logging metrics update high_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:
gcloud logging metrics update high_severity_count --config-from-file=$PATH_TO_FILEThe config file should be in YAML format. Detailed information about how to configure 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 the config file will not be updated in the metric.
To update the bucket associated with a bucket log-based metric, run:
gcloud logging metrics update my-bucket-metric --bucket-name="NEW_BUCKET_NAME"METRIC_NAME--config-from-file=PATH_TO_FILE--bucket-name=BUCKET_NAME--description=DESCRIPTION--log-filter=LOG_FILTER--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 metrics updategcloud beta logging metrics update
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.