snippets.py is a simple command-line program to demonstrate writing to a log,
listing its entries, and deleting it.
export.py demonstrates how to interact with sinks which are used to export
logs to Google Cloud Storage, Cloud Pub/Sub, or BigQuery. The sample uses
Google Cloud Storage, but can be easily adapted for other outputs.
All samples require a Google Cloud Project.
To run export.py, you will also need a Google Cloud Storage Bucket.
gsutil mb gs://[YOUR_PROJECT_ID]
You must add Cloud Logging as an owner to the bucket. To do so, add
cloud-logs@google.com as an owner to the bucket. See the
exportings logs
docs for complete details.
Use the Cloud SDK to provide authentication:
gcloud beta auth application-default login
Run the samples:
python snippets.py -h
python export.py -h