1.0.8 • Published 3 years ago

simple-log-cloudwatch v1.0.8

Weekly downloads
27
License
ISC
Repository
-
Last release
3 years ago

Simple Log Cloudwatch

This library is useful to send logs to cloudwatch.

Getting Started

Installation

Install via NPM:

npm install simple-log-cloudwatch

Using

Import the package once it is installed

const { simpleLogCloudwatch }  =  require('simple-log-cloudwatch');

Next step is to set the credentials

const simpleLog = new simpleLogCloudwatch({
    logGroupName: 'xxxx', 
    region: 'xxxxx', 
    accessKeyId: 'xxxxx', 
    secretAccessKey: 'xxxxxxxx',
    apiVersionCloudwatch: 'xxxxxx'
});

===========================================

You need to create the Log Group inside of AWS.

===========================================

Finally to save the logs in Cloudwatch you need to invoke the function createLog and pass two parameters

===========================================

Log Stream

type: String

value: Name of the Log Event (Example: '29-12-2020')

Messages

type: Array of String

value: Messages that will be send it to Cloudwatch

===========================================

simpleLog.createLog("29-12-2020",["test-message-1","test-message-2"])

Example

//import 
const { simpleLogCloudwatch }  =  require('simple-log-cloudwatch');

//set the credentials of aws
const simpleLog = new simpleLogCloudwatch({
    logGroupName: 'xxxx', 
    region: 'xxxxx', 
    accessKeyId: 'xxxxx', 
    secretAccessKey: 'xxxxxxxx',
    apiVersionCloudwatch: 'xxxxxx'
});


//create the logs
simpleLog.createLog("01-01-2020",["test-message-1","test-message-2"])

Additional Info

  • You need to have the permission to create Log Stream in Cloudwatch
  • You need to have the permission to put Log Events in Cloudwatch
  • You need to create first the Log Group inside of AWS
1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago