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 = ;
Create a new logger:
const logger = stage: 'PROD' stack: 'my-stack' app: 'my-app' roleArn: 'arn:aws:iam::000000000000:role/my-role' streamName: 'my-stream';
Open the logger:
logger;
Write a log message:
logger;
Ensure all logs have written by closing the logger:
logger;
Complete example
const ELKKinesisLogger = ; const logger = stage: 'PROD' stack: 'my-stack' app: 'my-app' roleArn: 'arn:aws:iam::000000000000:role/my-role' streamName: 'my-stream'; logger;
Further examples
See the examples.
Contributing
- clone the repo
- update the code
- write a test
npm test
- commit
Publishing
npm publish