Stackdriver Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.
-
Read Prerequisites and How to run a sample first.
-
Install dependencies:
With
npm
:npm install
With
yarn
:yarn install
View the documentation or the source code.
Usage: node logs --help
Commands:
list List log entries in the authenticated project.
write <name> <resource> <entry> Write a log entry.
delete <name> Delete a Log.
Options:
--help Show help [boolean]
Examples:
node logs list List all log entires.
node logs list -f "severity = ERROR" -s List up to 2 error entries, sorted by
"timestamp" -l 2 timestamp ascending.
node logs write my-log Write a log entry.
'{"type":"gae_app","labels":{"module_id":"default"
}}' '{"message":"Hello World!"}'
node logs delete my-log Delete "my-log".
For more information, see https://cloud.google.com/logging/docs
View the documentation or the source code.
Usage: node sinks --help
Commands:
create <name> <destination> Create a new sink with the given name and destination.
get <name> Get the metadata for the specified sink.
list List all sinks in the authenticated project.
update <name> <metadata> Update the metadata for the specified sink.
delete <name> Delete the specified sink.
Options:
--help Show help [boolean]
Examples:
node sinks create my-sink my-bucket --type bucket Create a new sink named "my-sink" that exports
logs to a Cloud Storage bucket.
node sinks create my-sink my-dataset --type Create a new sink named "my-sink" that exports
dataset logs to a BigQuery dataset.
node sinks create my-sink my-topic --type topic Create a new sink named "my-sink" that exports
logs to a Cloud Pub/Sub topic.
node sinks get my-sink Get the metadata for "my-sink".
node sinks list List all sinks in the authenticated project.
node sinks update my-sink '{"filter":"severity > Update the specified sink.
ALERT"}'
node sinks delete my-sink Delete "my-sink".
For more information, see https://cloud.google.com/logging/docs
View the documentation or the source code.
-
Set the
GCLOUD_PROJECT
andGOOGLE_APPLICATION_CREDENTIALS
environment variables. -
Run the tests:
With
npm
:npm test
With
yarn
:yarn test