cloudwatch-logs-hose
v0.0.2
Published
Transforms a CloudWatch Logs Group into a streaming hose of events
Readme
![]()
cloudwatch-logs-hose
Transforms a CloudWatch Logs Group into a streaming hose of events
Get it
npm install cloudwatch-logs-hose
Usage
var hose = require('cloudwatch-logs-hose');
var src = new hose.Source({
LogGroup: '/aws/lambda/MINUS-49dda359e9abcd4e180f73bd8ba7e2f9',
aws: { region: 'us-west-2' }
});
src.on('logs', function(batch) {
for(var i in batch) console.log('Log: ', batch[i].message.trim());
});
src.on('error', function(error) {
console.log('Error: ', error);
});
src.open();Available commands
Source.open()opens the hose, polling startsSource.close()closes the hose, polling stopsSource.on('logs', fn)adds an event handler when a batch of logs is pulledSource.on('error', fn)adds an event handler when an error occurs
Available Source parameters
LogGroupMandatory / The AWS CloudWatch Log Group to pollStartTimeOptional / Default tonow/ unix timestamp from where the logs should be pulledEndTimeOptional / Default tonull/ unix timestamp from where the pulling should stopLogStreamPrefixOptional / Defaults to''/ the prefix of the log streams to watch.''will match all streamsPollInterval/ Optional / Default to1000/ milliseconds between each pollingaws/ Mandatory / the AWS Configuration. See this for more information
