winston-cloudwatch-transport
This is a rewrite/modification of
winston-cloudwatch. This module allows for multiple instances of the cloudwatch transport to be used with Winston.Allowing you to leverage winston categories for logging to multiple CloudWatch Log Groups/Streams.
Installation
npm install winston winston-cloudwatch-transport
Configuration
By File
AWS configuration works using~/.aws/credentials
as written in AWS JavaScript SDK guide.By Environment Variables
AWS_ACCESS_KEY_ID = <Your AWS Access key>
AWS_SECRET_KEY = <Your AWS Secret Key>
AWS_REGION = <Region containing your CloudWatch Log Group>
Usage
Options
logGroupName logStreamName name - Optional Defaults to "cloudwatch" + logGroupName + logStreamName level - Optional Defaults to debug awsAccessKeyId - Optional if provided by environment variable AWSACCESSKEYID or ~/.aws/credentials/ awsSecretKey - Optional if provided by environment variable AWSSECRETKEY or ~/.aws/credentials/ awsRegion - Optional if provided by environment variable AWSREGIONExample
var winston = require('winston');
winston.transports.<Transport Name> = new require('winston-cloudwatch-transport', {
logGroupName: <Log Group Name>,
logStreamName: <Log Stream Name>
});