gcloud_beta_logging_read (1)
NAME
- gcloud beta logging read - read log entries
SYNOPSIS
-
gcloud beta logging read [LOG_FILTER] [--freshness=FRESHNESS; default="1d"] [--order=ORDER; default="desc"] [--billing-account=BILLING_ACCOUNT_ID | --folder=FOLDER_ID | --organization=ORGANIZATION_ID] [--limit=LIMIT] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) gcloud beta logging read reads log entries. Log entries matching log-filter are returned in order of decreasing timestamps, most-recent
POSITIONAL ARGUMENTS
-
- [LOG_FILTER]
-
Filter expression that specifies the log entries to return. A detailed guide on
basic and advanced filters can be found at:
cloud.google.com/logging/docs/view/overview
FLAGS
-
- --freshness=FRESHNESS; 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.
- --order=ORDER; default="desc"
-
Ordering of returned log entries based on timestamp field. ORDER must be
one of: desc, asc.
-
At most one of these may be specified:
-
- --billing-account=BILLING_ACCOUNT_ID
-
Read log entries associated with this billing account.
- --folder=FOLDER_ID
-
Read log entries associated with this folder.
- --organization=ORGANIZATION_ID
-
Read log entries associated with this organization.
-
LIST COMMAND FLAGS
-
- --limit=LIMIT
-
Maximum number of resources to list. The default is unlimited. This flag
interacts with other flags that are applied in this order: --flatten,
--sort-by, --filter, --limit.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
EXAMPLES
To read log entries from Google Compute Engine instances, run:
- $ gcloud beta logging read "resource.type=gce_instance"
To read log entries with severity ERROR or higher, run:
- $ gcloud beta logging read "severity>=ERROR"
To read log entries written in a specific time window, run:
-
$ gcloud beta logging read \
'timestamp<="2015-05-31T23:59:59Z" AND
timestamp>="2015-05-31T00:00:00Z"'
To read up to 10 log entries in your project's syslog log from Compute Engine instances containing payloads that include the word SyncAddress and format the output in JSON format, run:
-
$ gcloud beta logging read \
"resource.type=gce_instance AND\
logName=projects/[PROJECT_ID]/logs/syslog AND\
textPayload:SyncAddress" --limit=10 --format=json
To read a log entry from a folder, run:
-
$ gcloud beta logging read "resource.type=global" \
--folder=[FOLDER_ID] --limit=1
Detailed information about filters can be found at: cloud.google.com/logging/docs/view/advanced_filters
NOTES
This command is currently in BETA and may change without notice. This variant is also available:
- $ gcloud logging read