Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Outline

Stackdriver Logging v2 API Samples

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.

Prerequisites

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.

Running locally

Use the Cloud SDK to provide authentication:

gcloud beta auth application-default login

Run the samples:

python snippets.py -h
python export.py -h
Morty Proxy This is a proxified and sanitized view of the page, visit original site.