mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-08 18:45:13 +00:00
83 lines
2.9 KiB
Text
83 lines
2.9 KiB
Text
NAME
|
|
gcloud alpha logging metrics create - creates a logs-based metric
|
|
|
|
SYNOPSIS
|
|
gcloud alpha logging metrics create METRIC_NAME
|
|
(--config-from-file=CONFIG_FROM_FILE
|
|
| [--description=DESCRIPTION --log-filter=LOG_FILTER
|
|
: --bucket-name=BUCKET_NAME]) [GCLOUD_WIDE_FLAG ...]
|
|
|
|
DESCRIPTION
|
|
(ALPHA) Creates a logs-based metric to count the number of log entries that
|
|
match a filter expression. Logs-based metrics can also be used to extract
|
|
values from logs and create a distribution of the values.
|
|
|
|
EXAMPLES
|
|
To create a metric that counts the number of log entries with a severity
|
|
level higher than WARNING, run:
|
|
|
|
$ gcloud alpha logging metrics create high_severity_count \
|
|
--description="Number of high severity log entries" \
|
|
--log-filter="severity > WARNING"
|
|
|
|
Detailed information about filters can be found at:
|
|
https://cloud.google.com/logging/docs/view/logging-query-language
|
|
|
|
To create a metric that uses advanced features like distribution or
|
|
user-defined labels, run:
|
|
|
|
$ gcloud alpha logging metrics create my_metric \
|
|
--config-from-file=$PATH_TO_FILE
|
|
|
|
The config file can be in YAML or JSON 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.
|
|
|
|
POSITIONAL ARGUMENTS
|
|
METRIC_NAME
|
|
The name of the new metric.
|
|
|
|
REQUIRED FLAGS
|
|
Data about the new metric.
|
|
|
|
Exactly one of these must be specified:
|
|
|
|
--config-from-file=CONFIG_FROM_FILE
|
|
A path to a YAML or JSON file specifying the logs-based metric to
|
|
create.
|
|
|
|
A group of arguments to specify simple counter logs-based metrics.
|
|
|
|
--description=DESCRIPTION
|
|
The metric's description.
|
|
|
|
This flag argument must be specified if any of the other arguments
|
|
in this group are specified.
|
|
|
|
--log-filter=LOG_FILTER
|
|
The metric's filter expression.
|
|
|
|
This flag argument must be specified if any of the other arguments
|
|
in this group are specified.
|
|
|
|
--bucket-name=BUCKET_NAME
|
|
The Log Bucket name which owns the log-based metric.
|
|
|
|
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 help for details.
|
|
|
|
NOTES
|
|
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 create
|
|
|
|
$ gcloud beta logging metrics create
|
|
|