cloudwatch-logs-writable

0.1.0 • Public • Published

cloudwatch-logs-writable

A writable stream to AWS CloudWatch Logs that adheres to CloudWatch Log limits (see http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html):

  • Max 10,000 entries per putLogEvents(),
  • Max 5 putLogEvents() per second,
  • Max batch size of 1,048,576 bytes

Installation

# npm install cloudwatch-logs-writable

Options

group (required)

The log group name used in AWS CloudWatch Logs. It will attempt to create the log group if it does not exist.

name (required)

The log stream name used in AWS CloudWatch Logs. It will attempt to create the stream if it does not exist.

region

The AWS region for AWS CloudWatch Logs. Only required if you do not have AWS configured elsewhere or want a different location than already configured.

accessKeyId

The AWS access key ID for the user allowed to putLogEvents(). Only required if you do not have AWS configured elsewhere or want a different location than already configured.

secretAccessKey

The AWS secret access key for the user allowed to putLogEvents(). Only required if you do not have AWS configured elsewhere or want a different location than already configured.

Usage

Below is a example of processing stdin and pushing each line to AWS CloudWatch logs.

var CloudWatchLogs = require('cloudwatch-logs-writable');
var pump = require('pump');
var split = require('split2');
var cloudwatch = CloudWatchLogs({
  group: 'log-group-name',
  name: 'log-stream-name',
  region: 'ap-southeast-2'
});
 
pump(process.stdin, split(), cloudwatch);

Test

# npm run test

Dependencies (7)

Dev Dependencies (8)

Package Sidebar

Install

npm i cloudwatch-logs-writable

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • davidh