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

elk-kinesis-logger

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elk-kinesis-logger

Logging to a Kinesis stream for consumption into an ELK cluster

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

CircleCI

ELK Kinesis Logger

Send logs to an ELK stack via an AWS Kinesis stream.

The ELK stack should be using the Kinesis Input Plugin.

Uses STSAssumeRole to authenticate to Kinesis.

Why

The main use case is for AWS Lambdas. When you console.log within a Lambda, they go into CloudWatch Logs. Whilst CloudWatch Logs is good, an ELK stack is better!

Using this module, we can easily get logs into an ELK stack.

Installation

npm install elk-kinesis-logger

Usage

Import the module:

const ELKKinesisLogger = require('elk-kinesis-logger');

Create a new logger:

const logger = new ELKKinesisLogger({
  stage: 'PROD',
  stack: 'my-stack',
  app: 'my-app',
  roleArn: 'arn:aws:iam::000000000000:role/my-role',
  streamName: 'my-stream'
});

Open the logger:

logger.open().then(() => {
    
});

Write a log message:

logger.log('something happened');

Ensure all logs have written by closing the logger:

logger.close().then(() => {
    
});

Complete example

const ELKKinesisLogger = require('elk-kinesis-logger');

const logger = new ELKKinesisLogger({
  stage: 'PROD',
  stack: 'my-stack',
  app: 'my-app',
  roleArn: 'arn:aws:iam::000000000000:role/my-role',
  streamName: 'my-stream'
});

logger.open().then(() => {
  const value = 5 * 5;
  
  logger.log(`the value is ${value}`);
  
  return logger.close();
}).then((writtenLogs) => {
  // other work
});

Further examples

See the examples.

Contributing

  • clone the repo
  • update the code
  • write a test
  • npm test
  • commit

Publishing

  • npm publish

FAQs

Package last updated on 11 Apr 2017

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