HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/current/help/man/man1/gcloud_alpha_logging_metrics_create.1
.TH "GCLOUD_ALPHA_LOGGING_METRICS_CREATE" 1



.SH "NAME"
.HP
gcloud alpha logging metrics create \- create a logs\-based metric



.SH "SYNOPSIS"
.HP
\f5gcloud alpha 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(ALPHA)\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 alpha 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 alpha 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 alpha 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 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:

.RS 2m
$ gcloud logging metrics create
.RE

.RS 2m
$ gcloud beta logging metrics create
.RE