Tiny, super simple Kinesis Firehose transport for Winston.js 3
Via NPM
npm install --save winston-firetruck
Via Yarn
yarn add winston-firetruck
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!
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
}
})]
});