File: //snap/google-cloud-cli/current/help/man/man1/gcloud_alpha_logging_read.1
.TH "GCLOUD_ALPHA_LOGGING_READ" 1
.SH "NAME"
.HP
gcloud alpha logging read \- read log entries
.SH "SYNOPSIS"
.HP
\f5gcloud alpha logging read\fR [\fILOG_FILTER\fR] [\fB\-\-freshness\fR=\fIFRESHNESS\fR;\ default="1d"] [\fB\-\-order\fR=\fIORDER\fR;\ default="desc"] [\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] [\fB\-\-resource\-names\fR=[\fIRESOURCE\fR,...]\ |\ \fB\-\-bucket\fR=\fIBUCKET\fR\ \fB\-\-location\fR=\fILOCATION\fR\ \fB\-\-view\fR=\fIVIEW\fR] [\fB\-\-limit\fR=\fILIMIT\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(ALPHA)\fR gcloud alpha logging read reads log entries. Log entries matching
\fBlog\-filter\fR are returned in order of decreasing timestamps, most\-recent
entries first. If the log entries come from multiple logs, then entries from
different logs might be intermingled in the results.
.SH "EXAMPLES"
To read log entries from Google Compute Engine instances, run:
.RS 2m
$ gcloud alpha logging read "resource.type=gce_instance"
.RE
To read log entries with severity ERROR or higher, run:
.RS 2m
$ gcloud alpha logging read "severity>=ERROR"
.RE
To read log entries written in a specific time window, run:
.RS 2m
$ gcloud alpha logging read \e
'timestamp<="2015\-05\-31T23:59:59Z" AND
timestamp>="2015\-05\-31T00:00:00Z"'
.RE
To read up to 10 log entries in your project's syslog log from Compute Engine
instances containing payloads that include the word \f5SyncAddress\fR and format
the output in \f5JSON\fR format, run:
.RS 2m
$ gcloud alpha logging read \e
"resource.type=gce_instance AND \e
logName=projects/[PROJECT_ID]/logs/syslog AND \e
textPayload:SyncAddress" \-\-limit=10 \-\-format=json
.RE
To read a log entry from a folder, run:
.RS 2m
$ gcloud alpha logging read "resource.type=global" \e
\-\-folder=[FOLDER_ID] \-\-limit=1
.RE
To read a log entry from a global log bucket, run:
.RS 2m
$ gcloud alpha logging read \-\-bucket=<bucket\-id> \e
\-\-location=[LOCATION] \-\-limit=1
.RE
To read a log entry from the global \f5_Required\fR log bucket using the
bucket's \f5_Default\fR log view:
.RS 2m
$ gcloud alpha logging read "" \-\-bucket=_Required \e
\-\-location=global \-\-view=_Default \-\-limit=1
.RE
To read a log entry from a log bucket using the bucket's \f5_AllLogs\fR log
view:
.RS 2m
$ gcloud alpha logging read "" \-\-bucket=[BUCKET_ID] \e
\-\-location=[LOCATION] \-\-view=_AllLogs \-\-limit=1
.RE
To read a log entry from a log bucket using a custom log view that you have
created for the bucket:
.RS 2m
$ gcloud alpha logging read "" \-\-bucket=[BUCKET_ID] \e
\-\-location=[LOCATION] \-\-view=[VIEW_ID] \-\-limit=1
.RE
To read log entries from multiple resources, specify them as a comma\-delimeted
sequence with \-\-resource\-names. Each resource name can be specified either as
a top\-level resource (e.g., projects/[PROJECT_ID], folders/[FOLDER_ID], etc.)
or as a Log View resource (e.g.,
projects/[PROJECT_ID]/locations/[LOCATION]/buckets/[BUCKET_NAME]/views/[VIEW_ID]).
.RS 2m
$ gcloud alpha logging read "" \e
\-\-resource\-names=[RESOURCE\-1],[RESOURCE\-2]
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
[\fILOG_FILTER\fR]
Filter expression that specifies the log entries to return. Detailed information
about filters can be found at:
https://cloud.google.com/logging/docs/view/logging\-query\-language
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
\fB\-\-freshness\fR=\fIFRESHNESS\fR; default="1d"
Return entries that are not older than this value. Works only with DESC ordering
and filters without a timestamp. See $ gcloud topic datetimes for information on
duration formats.
.TP 2m
\fB\-\-order\fR=\fIORDER\fR; default="desc"
Ordering of returned log entries based on timestamp field. \fIORDER\fR must be
one of: \fBdesc\fR, \fBasc\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 read.
.TP 2m
\fB\-\-folder\fR=\fIFOLDER_ID\fR
Folder of the log entries to read.
.TP 2m
\fB\-\-organization\fR=\fIORGANIZATION_ID\fR
Organization of the log entries to read.
.TP 2m
\fB\-\-project\fR=\fIPROJECT_ID\fR
Project of the log entries to read.
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
.sp
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-resource\-names\fR=[\fIRESOURCE\fR,...]
Resource name(s) to read logs from. A resource can either be an top\-level
resource (e.g., "projects/my\-project") or a full log view resource path (e.g.,
"projects/my\-project/locations/my\-location/buckets/my\-bucket/views/my\-view").
Multiple resources can be specified, separated by a comma.
.TP 2m
These arguments are used in conjunction with the parent to construct a view
resource.
.RS 2m
.TP 2m
\fB\-\-bucket\fR=\fIBUCKET\fR
Id of the log bucket. If this argument is provided then \f5\-\-location\fR and
\f5\-\-view\fR must also be specified.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-location\fR=\fILOCATION\fR
Location of the log bucket. If this argument is provided then \f5\-\-bucket\fR
and \f5\-\-view\fR must also be specified.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-view\fR=\fIVIEW\fR
Id of the view. If this argument is provided then \f5\-\-location\fR and
\f5\-\-bucket\fR must also be specified.
This flag argument must be specified if any of the other arguments in this group
are specified.
.RE
.RE
.RE
.sp
.SH "LIST COMMAND FLAGS"
.RS 2m
.TP 2m
\fB\-\-limit\fR=\fILIMIT\fR
Maximum number of resources to list. The default is \fBunlimited\fR. This flag
interacts with other flags that are applied in this order: \fB\-\-flatten\fR,
\fB\-\-sort\-by\fR, \fB\-\-filter\fR, \fB\-\-limit\fR.
.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 read
.RE
.RS 2m
$ gcloud beta logging read
.RE