Skip to content

Transforms a CloudWatch Logs Group into a streaming hose of events

License

Notifications You must be signed in to change notification settings

mentum/cloudwatch-logs-hose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon

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 starts
  • Source.close() closes the hose, polling stops
  • Source.on('logs', fn) adds an event handler when a batch of logs is pulled
  • Source.on('error', fn) adds an event handler when an error occurs

Available Source parameters

  • LogGroup Mandatory / The AWS CloudWatch Log Group to poll
  • StartTime Optional / Default to now / unix timestamp from where the logs should be pulled
  • EndTime Optional / Default to null / unix timestamp from where the pulling should stop
  • LogStreamPrefix Optional / Defaults to '' / the prefix of the log streams to watch. '' will match all streams
  • PollInterval / Optional / Default to 1000 / milliseconds between each polling
  • aws / Mandatory / the AWS Configuration. See this for more information

About

Transforms a CloudWatch Logs Group into a streaming hose of events

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published