@google-cloud/pino-logging-gcp-config
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Pino Google Cloud Logging configuration for Node.JS

This library contains the code to generate a Pino configuration which outputs JSON structured logs for Google Cloud Logging.

This can be used with any Google Cloud service that captures logs written to stdout (such as Cloud Run, Cloud Run Functions and Google Kubernetes Engine workloads), so that the logging is formatted correctly in Google Cloud Logging. This then alllows filtering by log level, the ability to include structured data in the logs, and reporting of errors with stack traces to Google Cloud Error Reporting

Features

  • Converts Pino log levels to Google Cloud Logging log levels.
  • Uses message instead of msg for the message key.
  • Adds a millisecond-granularity timestamp in a format recognised by Google Cloud Logging, eg:
    "timestamp":{"seconds":1445470140,"nanos":123000000}.
  • Adds a sequential insertId to ensure log messages with identical timestamps are ordered correctly.
  • Logs including an Error object have the stack_trace property set so that the error is forwarded to Google Cloud Error Reporting.
  • Includes a ServiceContext object in the logs for Google Cloud Error Reporting.
  • Maps the OpenTelemetry properties span_id, trace_id, trace_flags to the equivalent Google Cloud Logging fields.

See the full documentation on Github.

Package Sidebar

Install

npm i @google-cloud/pino-logging-gcp-config

Weekly Downloads

8,692

Version

1.0.2

License

Apache-2.0

Unpacked Size

419 kB

Total Files

26

Last publish

Collaborators

  • google-wombot
  • google-admin