File: //snap/google-cloud-cli/394/help/man/man1/gcloud_beta_logging_metrics_create.1
.TH "GCLOUD_BETA_LOGGING_METRICS_CREATE" 1
.SH "NAME"
.HP
gcloud beta logging metrics create \- create a logs\-based metric
.SH "SYNOPSIS"
.HP
\f5gcloud beta logging metrics create\fR \fIMETRIC_NAME\fR (\fB\-\-config\-from\-file\fR=\fIPATH_TO_FILE\fR\ |\ [\fB\-\-description\fR=\fIDESCRIPTION\fR\ \fB\-\-log\-filter\fR=\fILOG_FILTER\fR\ :\ \fB\-\-bucket\-name\fR=\fIBUCKET_NAME\fR]) [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(BETA)\fR Create 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.
.SH "EXAMPLES"
To create a metric that counts the number of log entries with a severity level
higher than WARNING, run:
.RS 2m
$ gcloud beta logging metrics create high_severity_count \e
\-\-description="Number of high severity log entries" \e
\-\-log\-filter="severity > WARNING"
.RE
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:
.RS 2m
$ gcloud beta logging metrics create my_metric \e
\-\-config\-from\-file=$PATH_TO_FILE
.RE
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.
To create a bucket log\-based metric, run:
.RS 2m
$ gcloud beta logging metrics create my_bucket_metric \e
\-\-description="DESCRIPTION" \-\-log\-filter="LOG_FILTER" \e
\-\-bucket\-name="BUCKET_NAME"
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIMETRIC_NAME\fR
The name of the new metric.
.RE
.sp
.SH "REQUIRED FLAGS"
.RS 2m
.TP 2m
Data about the new metric.
Exactly one of these must be specified:
.RS 2m
.TP 2m
\fB\-\-config\-from\-file\fR=\fIPATH_TO_FILE\fR
A path to a YAML or JSON file specifying the logs\-based metric to create. Use a
full or relative path to a local file containing the value of config.
.TP 2m
A group of arguments to specify simple counter logs\-based metrics.
.RS 2m
.TP 2m
\fB\-\-description\fR=\fIDESCRIPTION\fR
The metric's description.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-log\-filter\fR=\fILOG_FILTER\fR
The metric's filter expression.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-bucket\-name\fR=\fIBUCKET_NAME\fR
The Log Bucket name which owns the log\-based metric.
.RE
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in beta and might change without notice. These
variants are also available:
.RS 2m
$ gcloud logging metrics create
.RE
.RS 2m
$ gcloud alpha logging metrics create
.RE