egg-elk

1.1.0 • Public • Published

egg-elk

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Description

egg elk log plugin

Install

$ npm i egg-elk --save

Usage

// {app_root}/config/plugin.js
exports.elk = {
  enable: true,
  package: 'egg-elk',
};

Configuration

type CategoryTypes = 'logger' | 'errorLogger' | 'coreLogger' | 'scheduleLogger';

interface ELKConfig {
  host: string;
  port: number;
  logType?: string;
  categories?: CategoryTypes[];
  tcp?: {
    maxConnections: number;
    retryInterval: number;
    timeout: number;
  };
  fields?: {
    [key: string]: string;
  };
}
Property Description Type Default
host elk host string -
port elk port number -
logType type of your log string -
categories - CategoryTypes[] ['logger']
tcp tcp config - { maxConnections: 300, retryInterval: 500, timeout: 5000 }
fields custom tags { [key: string]: string; } -
// {app_root}/config/config.default.js
exports.elk = {
  host: '127.0.0.1',
  port: 80,
  logType: 'eggElkLogType',
  fields: {
    tag: 'kurt',
  },
  categories: [ 'logger' ],
  tcp: {
    maxConnections: 300,
    retryInterval: 500,
    timeout: 5000,
  },
};

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i egg-elk

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

13.8 kB

Total Files

9

Last publish

Collaborators

  • kurtshen