Skip to content

1xtr/moleculer-cloudwatch-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moleculer logo

NPM version NPM Downloads

Send logs to AWS CloudWatch

This is a fork from native Datadog logger

Description

Easy to send logs directly to AWS CloudWatch

Install

$ npm install @1xtr/moleculer-cloudwatch-logger --save

Import

// ES5 example
const CloudWatchLogger = require('@1xtr/moleculer-cloudwatch-logger');

// ES6+ example
import { CloudWatchLogger } from '@1xtr/moleculer-cloudwatch-logger';

Usage

module.exports = {
  logger: new CloudWatchLogger({
    // put here your options
  })
}

Default options

const defaultOptions = {
  clientOptions: {},
  source: process.env.MOL_NODE_NAME || 'moleculer',
  hostname: hostname(),
  objectPrinter: null,
  interval: 5 * 1000,
  excludeModules: [],
  logGroupName: `mol-${process.env.MOL_NODE_NAME || hostname()}`,
}

Options example

{
  "clientOptions": {
    "region": "us-east-1"
  },
  "excludeModules": [
    "broker",
    "registry",
    "discovery",
    "transporter",
    "$node",
    "transit",
    "cacher"
  ]
}