1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-09 10:56:49 +00:00
gcloud-help/gcloud/alpha/logging/write

109 lines
4 KiB
Text
Raw Normal View History

2022-03-01 04:29:52 +00:00
NAME
gcloud alpha logging write - write a log entry
SYNOPSIS
gcloud alpha logging write LOG_NAME MESSAGE
2025-04-16 10:41:40 +00:00
[--monitored-resource-labels=[KEY=VALUE, ...,...]]
[--monitored-resource-type=MONITORED_RESOURCE_TYPE; default="global"]
2022-03-01 04:29:52 +00:00
[--payload-type=PAYLOAD_TYPE; default="text"]
[--severity=SEVERITY; default="DEFAULT"]
[--billing-account=BILLING_ACCOUNT_ID | --folder=FOLDER_ID
| --organization=ORGANIZATION_ID | --project=PROJECT_ID]
[GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(ALPHA) Write a log entry. If the destination log does not exist, it will
2025-04-16 10:41:40 +00:00
be created. By default, all log entries written with this command are
written with the "global" resource type.
2022-03-01 04:29:52 +00:00
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/
EXAMPLES
To create a log entry in a given log, run:
$ gcloud alpha logging write LOG_NAME "A simple entry"
To create a high severity log entry, run:
$ gcloud alpha logging write LOG_NAME "Urgent message" \
--severity=ALERT
To create a structured log, run:
$ gcloud alpha logging write LOG_NAME '{"key": "value"}' \
--payload-type=json
2025-04-16 10:41:40 +00:00
To create a log entry with a custom resource type, run:
$ gcloud alpha logging write LOG_NAME "A simple entry" \
--monitored-resource-type=gce_instance \
--monitored-resource-labels=zone=us-centra1-a,instance_id=1234
2022-03-01 04:29:52 +00:00
POSITIONAL ARGUMENTS
LOG_NAME
Name of the log where the log entry will be written.
MESSAGE
Message to put in the log entry. It can be JSON if you include
--payload-type=json.
FLAGS
2025-04-16 10:41:40 +00:00
--monitored-resource-labels=[KEY=VALUE, ...,...]
Monitored Resource labels to add to the payload
--monitored-resource-type=MONITORED_RESOURCE_TYPE; default="global"
Monitored Resource type to add to the payload
2022-03-01 04:29:52 +00:00
--payload-type=PAYLOAD_TYPE; default="text"
Type of the log entry payload. PAYLOAD_TYPE must be one of: text, json.
--severity=SEVERITY; default="DEFAULT"
Severity level of the log entry. SEVERITY must be one of: DEFAULT,
DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY.
At most one of these can be specified:
--billing-account=BILLING_ACCOUNT_ID
2023-01-19 00:56:33 +00:00
Billing account of the log entries to write.
2022-03-01 04:29:52 +00:00
--folder=FOLDER_ID
2023-01-19 00:56:33 +00:00
Folder of the log entries to write.
2022-03-01 04:29:52 +00:00
--organization=ORGANIZATION_ID
2023-01-19 00:56:33 +00:00
Organization of the log entries to write.
2022-03-01 04:29:52 +00:00
--project=PROJECT_ID
2023-01-19 00:56:33 +00:00
Project of the log entries to write.
2022-03-01 04:29:52 +00:00
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 gcloud config list --format='text(core.project)' and can
be set using gcloud config set project PROJECTID.
--project and its fallback core/project 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 --billing-project or billing/quota_project property.
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 $ gcloud help for details.
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:
$ gcloud logging write
$ gcloud beta logging write