New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

awslogs-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awslogs-stream

Writable stream to publish logs to AWS CloudWatch Logs

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
263
decreased by-36.47%
Maintainers
1
Weekly downloads
 
Created
Source

#awslogs-stream

Stream to write logs to AWS CloudWatch.

This is actually a plain Node.js Writable object stream.

##Usage

var bunyan = require('bunyan');
var CloudWatchStream = require('awslogs-stream');

var stream = CloudWatchStream({
  logGroupName: 'my-group',
  logStreamName: 'my-stream',
  cloudWatchLogsOptions: {
    region: 'us-west-1'
  },
  processLogRecord: function(record) {
    return {
      message: JSON.stringify(record),
      timestamp: 1*new Date(record.time)
    }
  }
});

var log = bunyan.createLogger({
  name: 'foo',
  streams: [
    {
      stream: stream,
      type: 'raw'
    }
  ]
});

##API

###CloudWatchStream(opts) With opts of:

  • logGroupName (required)
  • logStreamName (required)
  • cloudWatchLogsOptions (optional): options passed to the AWS.CloudWatchLogs constructor
  • cloudWatchLogs (optional): optional existing cloudwatchlogs client
  • processLogRecord (optional): function to process log records to for cloudwatch (it should return object with 2 properties: message to be string and timestamp to be unix timestamp)
  • bufferDuration (optional, by default it is 5000 ms) timeout between writes

On write of the first log, the module creates the logGroup and logStream if necessary.

We use the aws-sdk to write the logs - the AWS credentials have therefore to be configured using environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY).

##Contributors This project was created by Mirko Kiefer (@mirkokiefer) and almost rewritten by Denis Bardadym.

Keywords

FAQs

Package last updated on 15 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc