gcloud_logging_read (1)
NAME
- gcloud logging read - read log entries
SYNOPSIS
-
gcloud 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
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 logging read "resource.type=gce_instance"
To read log entries with severity ERROR or higher, run:
- $ gcloud logging read "severity>=ERROR"
To read log entries written in a specific time window, run:
-
$ gcloud 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 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 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 variant is also available:
- $ gcloud beta logging read