To use pino-stackdriver
from the command line, you need to install it globally:
npm install -g pino-stackdriver
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
You can pass the following options via cli arguments:
Short command | Full command | Description |
---|---|---|
-V | --version | Output 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 | --logName | The 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 | --help | Output usage information |
See the API documentation for details.