bunyan-gelf-formatter
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

bunyan-gelf-formatter

npm

Converts buynayn logs to GELF-compatible format.

Unlike other similar packages, bunyan-gelf-formatter doesn't send logs to Gaylog on its own, so it's ideal for usage with centralized log processors like Fluentd.

Raw bunyan logs cannot be processed by Fluentd GELF plugin due to incompatible level field. This package takes care of properly formatting the log level as well as other default GELF fields and flattening the JSON payloads.

Installation

npm i -S bunyan-gelf-formatter

Usage

Add it as a bunyan stream:

const bunyan = require('bunyan')
const { GelfStream } = require('bunyan-gelf-formatter')
 
const gelfStream = new GelfStream({})
gelfStream.pipe(process.stdout)
 
const logger = bunyan.createLogger({
    name: 'logger',
    streams: [{ type: 'raw', stream: gelfStream }]
})

/bunyan-gelf-formatter/

    Package Sidebar

    Install

    npm i bunyan-gelf-formatter

    Weekly Downloads

    6

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    38.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • ihor.diachenko