1.0.0 • Published 8 years ago
bragg-cloudwatch v1.0.0
bragg-cloudwatch
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.
Related
- bragg-sns - SNS middleware.
- bragg-dynamodb - DynamoDB middleware.
License
MIT © Sam Verschueren
1.0.0
8 years ago