gcloud alpha logging metrics update - update the definition of a logs-based metric
gcloud alpha logging metrics update METRIC_NAME (--config-from-file=CONFIG_FROM_FILE | --bucket-name=BUCKET_NAME --description=DESCRIPTION --log-filter=LOG_FILTER) [GCLOUD_WIDE_FLAG ...]
(ALPHA) Update the description or the filter expression of an existing logs-based metric.
To update the description of a metric called high_severity_count, run:
$ gcloud alpha logging metrics update high_severity_count \ --description="Count of high-severity log entries."
To update the filter expression of the metric, run:
$ gcloud alpha 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 alpha logging metrics update high_severity_count \ --config-from-file=$PATH_TO_FILE
The 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 alpha logging metrics update my-bucket-metric \ --bucket-name="NEW_BUCKET_NAME"
- METRIC_NAME
The name of the log-based metric to update.
- Data about the metric to update.
Exactly one of these must be specified:
- --config-from-file=CONFIG_FROM_FILE
A path to a YAML file specifying the updates to be made to the logs-based metric.
- 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.
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.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. These variants are also available:
$ gcloud logging metrics update
$ gcloud beta logging metrics update