Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dashbot-logger

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dashbot-logger

Lambda logger for a custom CloudWatch log group.

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125
decreased by-58.33%
Maintainers
5
Weekly downloads
 
Created
Source

dashbot-logger

dashbot-logger allows you to log to a specific log group in CloudWatch Logs apart from the default log group that Lambda functions set up. The logger works around the 5 putLogEvent/s limit by batching up log events and using a pool of log streams to put log events to.

Setup

This package uses the aws-sdk, and will require an AWS account.

npm install --save dashbot-logger

Pass in your AWS credentials and a region as follows, or configure using one of the options listed here

  • region - string aws region
  • accessKeyId - string access key
  • secretAccessKey - string secret key
  • logGroupName - (required) string user specified log group name
const configuration = {
  region: <REGION>,
  accessKeyId: <ACCESS-KEY>,
  secretAccessKey: <SECRET-KEY>,
  logGroupName: <LOG-GROUP-NAME>,
}

const Logger = require('dashbot-logger')
const logger = new Logger(configuration)

You can also pass in additional configuration options to specify the behavior of the resource pool for log streams and naming of log streams.

Configuration Options

Available options:

  • debug - (default: false, boolean) logs helpful debugging information
  • logStreamPrefix - (default: dashbot, string) user specified log stream prefix
  • maxStreams - (default: 10, number) max number of log streams to use concurrently
  • minStreams - (default: 1, number) min number of log streams to use concurrently

Optionally, you can use the following environment variables to set certain options:

  • for logGroupName set DASHBOT_LOG_GROUP_NAME
  • for logStreamPrefix set DASBOT_LOG_STREAM_PREFIX
  • for maxStreams set DASHBOT_LOG_MAX_STREAMS
  • for minStreams set DASHBOT_LOG_MIN_STREAMS

Example

const configuration = {
  'logGroupName': 'test-group',
  'logStreamPrefix': 'test-stream',
  'maxStreams': 5,
  'minStreams': 2,
  'debug': true,
  'printErrors': true,
}

const Logger = require('dashbot-logger')
const logger = new Logger(configuration)

logger.log('test') // logs to log-group 'test-group' with string test

Keywords

FAQs

Package last updated on 08 Jul 2021

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