npm.io
1.0.0 • Published 10 years ago

bragg-cloudwatch

Licence
MIT
Version
1.0.0
Deps
1
Vulns
0
Weekly
0
Stars
2

bragg-cloudwatch Build Status

CloudWatch middleware for bragg.

This little piece of middleware makes it possible to handle a CloudWatch logstream as if they where normal requests.

Install

$ npm install --save bragg-cloudwatch

Usage

const app = require('bragg')();
const router = require('bragg-router')();
const cloudwatch = require('bragg-cloudwatch');

// Listen for the logstream with the filter name `unicorn`
router.post('dynamodb:unicorn', ctx => {
	console.log(ctx.request.body);
	//=> [{id: 'eventId1', timestamp: 1440442987000, message: '[ERROR] First error message'}]
});

app.use(cloudwatch());
app.use(router.routes());

exports.handler = app.listen();

The cloudwatch: prefix is attached by this module and is followed by the name of the filter. The event is provided in the body property of the request object.

API

cloudwatch([options])
options

Type: Object

Map a filter name to another name.

License

MIT Sam Verschueren

Keywords