ma-push-to-logs
v3.0.1
Published
this package is for mobilearts to push logs to ElasticSearch and S3
Downloads
85
Readme
ma-push-to-logs
this package is for mobilearts to push logs to ElasticSearch and S3 using AWS-SDKV3
Functions
- getLogsBody()
- async pushLogs(logs_body)
Installation
Install the dependencies.
cd yourpath
npm i ma-push-to-logs
Usage
After installation add requirment to your code
const Logs = require("ma-push-to-logs");
const LogsServices = new Logs();
getLogsBody()
this function is to help you build your json, it will return an object with all available fields in logs as attributes. access the attributes you want and change their values.
var logs_body = LogsServices.getLogsBody();
logs_body.RelatedTo = 'LogsName';
async pushLogs(logs_body)
this function will first check the validity of the object by making sure all attributes are of matching type to that of logs, and then put in eventbridge bus that'll push logs to ES and S3.
var results = await pushLogs(logs_body)
Example:
const Logs = require('ma-push-to-logs');
async myFunction() {
var logsServices = new Logs();
var logs_body = LogsServices.getLogsBody();
logs_body.RelatedTo = 'ExampleLog';
logs_body.SourceResponse = 'ok';
await LogsServices.pushLogs(logs_body);
};