2.0.0 • Published 8 years ago

winston-cloudwatch-transport-2 v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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 AWS_ACCESS_KEY_ID or ~/.aws/credentials/
  • awsSecretKey - Optional if provided by environment variable AWS_SECRET_KEY or ~/.aws/credentials/
  • awsRegion - Optional if provided by environment variable AWS_REGION
  • jsonMessage - Optional Defaults to true

Example

var winston = require('winston');
var WinstonTransport = require('winston-cloudwatch-transport');

winston.transports.YourCustomTransport = new WinstonTransport({
    logGroupName: 'Log Group Name',
    logStreamName: 'Log Stream Name'
});