Skip to content

Tiny, dead simple Kinesis Firehose transport for Winston.js

License

Notifications You must be signed in to change notification settings

elifitch/winston-firetruck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winston-🚒

Tiny, super simple Kinesis Firehose transport for Winston.js 3

Installation

Via NPM

npm install --save winston-firetruck

Via Yarn

yarn add winston-firetruck

Usage

The only required parameter is firehoseParams.DeliveryStreamName which should map to the name of your kinesis firehose. firehoseParams can also inlude any parameter you want to pass to the AWS Firehose constructor like credentials, sessionToken, or anything else enumerated in the AWS Firehose docs.

Additionally, the transport accepts a message formatter function to transform the log before it gets sent.

That's it!

Example

const messageFormatter = log => {
  const { timestamp, label, level, message } = log;
  return JSON.stringify({
    created: timestamp,
    level,
    label,
    message
  });
}
const myLogger = createLogger({
  transports: [new WinstonFiretruck({
    formatMessage: messageFormatter,
    firehoseParams: {
      DeliveryStreamName: 'my-log-stream-name',
      ...AdditionalAWSKinesisFirehoseParams
    }
  })]
});

About

Tiny, dead simple Kinesis Firehose transport for Winston.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published