0.2.3 • Published 4 years ago

bunyan-aws v0.2.3

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

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.

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

8 years ago