Skip to content

Write buynan logs to Amazon Web Services CloudWatch

License

Notifications You must be signed in to change notification settings

pling/bunyan-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bunyan-aws

Write buynan logs to Amazon Web Services CloudWatch.

Install

npm install bunyan-aws --save

Usage

var bunyan = require('bunyan');
var os = require('os');
var CloudWatchStream = require('bunyan-aws');
var myStream = new CloudWatchStream({
           logGroupName: 'MyApplicationLogs',
           logStreamName: 'MyStream-' + os.hostname(),
           cloudWatchOptions: {
               region: 'eu-central-1',
               sslEnabled: true
           }
       });
       
var log = bunyan.createLogger({
    name: 'logger',
    streams: [{
        stream: myStream,
        type: 'raw',
        level: 'info',
    }]
}; 
      
myStream.on('error', function (err) {
    console.error('Error in Cloud Watch stream', err);
});       

Configuration

AWS Credentials

This package uses the AWS SDK to write the logs to CloudWatch. You must set the AWS Credentials via one of the first three methods described here.

Log Group

The log group must exist in CloudWatch.

  1. Sign into the AWS console
  2. Click on CloudWatch found under Services > Management
  3. Click on Logs
  4. Select Actions > Create log group

Log Stream

You may use an existing log stream. However if the stream is not found, it will be created for you. The package assumes it is the only source writing to the stream. Errors will occur if other sources write to the same stream.

CloudWatch Options

These options are passed directly to the AWS SDK

Credits

This project was created by Aaron Schinkowitch (@schinkowitch), and is based on the work of Mirko Kiefer's bunyan-cloudwatch and Maurice Butler's bunyan-loggly. Hao Nguyen has made several fixes and improvements.

About

Write buynan logs to Amazon Web Services CloudWatch

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •