wac

winston-aws-cloudwatch

A Winston transport for Amazon CloudWatch.

Showing:

Popularity

Downloads/wk

10.8K

GitHub Stars

46

Maintenance

Last Commit

1yr ago

Contributors

6

Package

Dependencies

5

Size (min+gzip)

368.1KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

winston-aws-cloudwatch

npm Dependencies Build Status Coverage Status JavaScript Standard Style

A Winston transport for Amazon CloudWatch.

Usage

const winston = require('winston')
const CloudWatchTransport = require('winston-aws-cloudwatch')

const logger = winston.createLogger({
  transports: [
    new CloudWatchTransport({
      logGroupName: '...', // REQUIRED
      logStreamName: '...', // REQUIRED
      createLogGroup: true,
      createLogStream: true,
      submissionInterval: 2000,
      submissionRetryCount: 1,
      batchSize: 20,
      awsConfig: {
        accessKeyId: '...',
        secretAccessKey: '...',
        region: '...'
      },
      formatLog: item =>
        `${item.level}: ${item.message} ${JSON.stringify(item.meta)}`
    })
  ]
})

Error Handling

If, for any reason, logging to CloudWatch should fail, then the transport will emit an error event. It is recommended that you subscribe to this event to avoid crashes.

But Why?

As you may have noticed, there is also winston-cloudwatch, which predates this module. After making some contributions to that one, I felt like writing my own version. Feel free to use whichever you like best.

Author

Tim De Pauw

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial