egg-elk
v1.1.0
Published
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down
Downloads
31
Readme
egg-elk
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.