pino-humio-transport
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

pino-humio-transport

NPM version JavaScript Style Guide

A simple pino v7+ transport for sending logs to Humio Cloud.

It takes the log object, performs some transformations and sends it to Humio cloud. It only works for structured logs.

  • Does not feature batching, every log entry is being sent separately
  • Does not retry failed pushes

Table of Contents

Installation

npm install pino-humio-transport

import { LoggerOptions, pino } from 'pino'

const pinoConf: LoggerOptions = {
  level: 'trace',
}

const logger = pino(
  pinoConf,
  pino.transport({
    target: 'pino-humio-transport',
    options: {
      baseURL: 'https://cloud.community.humio.com',
      ingestToken: '...',
      timezone: 'Europe/Berlin',
      additionalAttributes: { env: env.ENV_NAME },
      ignore: 'pid,hostname',
      silent: true,
    },
  }),
)

Configuration options

export interface HumioTransportOptions {
  /**
   * The base URL.
   * By default it points to https://cloud.community.humio.com
   * */
  baseURL?: string
  /**
   * Your Humio ingest token
   * */
  ingestToken: string
  /**
   * A callback function that gets called at the end of the request
   * */
  callback?: (..._: any) => void
  /**
   * Additional attributes that get sent with every log object
   * */
  additionalAttributes?: Record<string, unknown>
  /**
   * Timezone. If you want to be extra precise.
   * */
  timezone?: string
  /**
   * Inhibits logs to console in case of errors
   * */
  silent?: boolean
  /**
   * Log object attributes to ignore.
   * Format: field1,field2,...
   * */
  ignore?: string
}

Package Sidebar

Install

npm i pino-humio-transport

Weekly Downloads

40

Version

1.3.0

License

MIT

Unpacked Size

14.3 kB

Total Files

19

Last publish

Collaborators

  • stefanpaduraru