CLI

November 26, 2020 ยท View on GitHub

To use pino-stackdriver from the command line, you need to install it globally:

npm install -g pino-stackdriver

Example

Given an application foo that logs via pino, a stackdriver log project bar and credentials in the file /credentials.json, you would use pino-stackdriver like so:

node foo | pino-stackdriver --project bar --credentials /credentials.json

Usage

You can pass the following options via cli arguments:

Short commandFull commandDescription
-V--versionOutput the version number
-p--project <project>Your Google Cloud Platform project ID (or use env var PROJECT_ID)
-c--credentials <credentials>The file path of the JSON file that contains your service account key (or use env var GOOGLE_APPLICATION_CREDENTIALS). you can also use clientEmail and privateKey instead of the path.
-e--clientEmail <email>Client email, part of credentials object provided by Google
-g--privateKey <googleKey>Private key, part of credentials object provided by Google.
-k--key <key:customKey>Repeatable key:customKey pairs for custom keys (see API docs)
-n--logNameThe resource to send logs to. Defaults to {"type": "global"}.
-r--resource <resourcejson>Resource to send the logs to, input in JSON (see API docs)
-h--helpOutput usage information

See the API documentation for details.