Skip to content

uWhisp/bunyan-cloudwatch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#bunyan-cloudwatch Build Status

Stream to write bunyan logs to AWS CloudWatch.

This is actually a plain Node.js Writable object stream so could be used without bunyan.

##Usage

var bunyan = require('bunyan');
var createCWStream = require('bunyan-cloudwatch');

var stream = createCWStream({
  logGroupName: 'my-group',
  logStreamName: 'my-stream',
  cloudWatchLogsOptions: {
    region: 'us-west-1'
  }
});

var log = bunyan.createLogger({
  name: 'foo',
  streams: [
    {
      stream: stream,
      type: 'raw'
    }
  ]
});

##API

###createCWStream(opts) With opts of:

  • logGroupName (required)
  • logStreamName (required)
  • cloudWatchLogsOptions (optional): options passed to the AWS.CloudWatchLogs constructor

On write of the first log, the module creates the logGroup and logStream if necessary.

We use the aws-sdk to write the logs - the AWS credentials have therefore to be configured using environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY).

##Contributors This project was created by Mirko Kiefer (@mirkokiefer).

About

Writable stream to write bunyan logs to AWS CloudWatch

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%