SamVerschueren / bragg-cloudwatch

CloudWatch middleware for bragg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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('cloudwatch: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

License

MIT © Sam Verschueren

About

CloudWatch middleware for bragg

License:MIT License


Languages

Language:JavaScript 100.0%