File: //snap/google-cloud-cli/396/help/man/man1/gcloud_alpha_logging_write.1
.TH "GCLOUD_ALPHA_LOGGING_WRITE" 1
.SH "NAME"
.HP
gcloud alpha logging write \- write a log entry
.SH "SYNOPSIS"
.HP
\f5gcloud alpha logging write\fR \fILOG_NAME\fR \fIMESSAGE\fR [\fB\-\-monitored\-resource\-labels\fR=[\fIKEY\fR=\fIVALUE\fR,\ ...,...]] [\fB\-\-monitored\-resource\-type\fR=\fIMONITORED_RESOURCE_TYPE\fR;\ default="global"] [\fB\-\-payload\-type\fR=\fIPAYLOAD_TYPE\fR;\ default="text"] [\fB\-\-severity\fR=\fISEVERITY\fR;\ default="DEFAULT"] [\fB\-\-billing\-account\fR=\fIBILLING_ACCOUNT_ID\fR\ |\ \fB\-\-folder\fR=\fIFOLDER_ID\fR\ |\ \fB\-\-organization\fR=\fIORGANIZATION_ID\fR\ |\ \fB\-\-project\fR=\fIPROJECT_ID\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR Write a log entry. If the destination log does not exist, it will
be created. By default, all log entries written with this command are written
with the "global" resource type.
gcloud alpha logging write should be used for simple testing purposes. Check
Cloud Logging agent for a proper way to send log entries:
https://cloud.google.com/logging/docs/agent/
.SH "EXAMPLES"
To create a log entry in a given log, run:
.RS 2m
$ gcloud alpha logging write LOG_NAME "A simple entry"
.RE
To create a high severity log entry, run:
.RS 2m
$ gcloud alpha logging write LOG_NAME "Urgent message" \e
\-\-severity=ALERT
.RE
To create a structured log, run:
.RS 2m
$ gcloud alpha logging write LOG_NAME '{"key": "value"}' \e
\-\-payload\-type=json
.RE
To create a log entry with a custom resource type, run:
.RS 2m
$ gcloud alpha logging write LOG_NAME "A simple entry" \e
\-\-monitored\-resource\-type=gce_instance \e
\-\-monitored\-resource\-labels=zone=us\-centra1\-a,instance_id=1234
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fILOG_NAME\fR
Name of the log where the log entry will be written.
.TP 2m
\fIMESSAGE\fR
Message to put in the log entry. It can be JSON if you include
\f5\-\-payload\-type=json\fR.
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-monitored\-resource\-labels\fR=[\fIKEY\fR=\fIVALUE\fR, ...,...]
Monitored Resource labels to add to the payload
.TP 2m
\fB\-\-monitored\-resource\-type\fR=\fIMONITORED_RESOURCE_TYPE\fR; default="global"
Monitored Resource type to add to the payload
.TP 2m
\fB\-\-payload\-type\fR=\fIPAYLOAD_TYPE\fR; default="text"
Type of the log entry payload. \fIPAYLOAD_TYPE\fR must be one of: \fBtext\fR,
\fBjson\fR.
.TP 2m
\fB\-\-severity\fR=\fISEVERITY\fR; default="DEFAULT"
Severity level of the log entry. \fISEVERITY\fR must be one of: \fBDEFAULT\fR,
\fBDEBUG\fR, \fBINFO\fR, \fBNOTICE\fR, \fBWARNING\fR, \fBERROR\fR,
\fBCRITICAL\fR, \fBALERT\fR, \fBEMERGENCY\fR.
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-billing\-account\fR=\fIBILLING_ACCOUNT_ID\fR
Billing account of the log entries to write.
.TP 2m
\fB\-\-folder\fR=\fIFOLDER_ID\fR
Folder of the log entries to write.
.TP 2m
\fB\-\-organization\fR=\fIORGANIZATION_ID\fR
Organization of the log entries to write.
.TP 2m
\fB\-\-project\fR=\fIPROJECT_ID\fR
Project of the log entries to write.
The Google Cloud project ID to use for this invocation. If omitted, then the
current project is assumed; the current project can be listed using \f5gcloud
config list \-\-format='text(core.project)'\fR and can be set using \f5gcloud
config set project PROJECTID\fR.
\f5\-\-project\fR and its fallback \f5core/project\fR property play two roles in
the invocation. It specifies the project of the resource to operate on. It also
specifies the project for API enablement check, quota, and billing. To specify a
different project for quota and billing, use \f5\-\-billing\-project\fR or
\f5billing/quota_project\fR property.
.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 write
.RE
.RS 2m
$ gcloud beta logging write
.RE