https://github.com/jirufik/jrf-graylog
A package that implements the udp logging client for Graylog
https://github.com/jirufik/jrf-graylog
client graylog jrf jrf-graylog log
Last synced: 2 months ago
JSON representation
A package that implements the udp logging client for Graylog
- Host: GitHub
- URL: https://github.com/jirufik/jrf-graylog
- Owner: jirufik
- Created: 2020-08-23T18:08:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-05T15:43:43.000Z (over 4 years ago)
- Last Synced: 2024-10-29T22:46:16.449Z (8 months ago)
- Topics: client, graylog, jrf, jrf-graylog, log
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jrf-graylog
## Description
A package that implements the `udp` logging client for [Graylog](https://www.graylog.org/)
## Example
```js
const Graylog = require('jrf-graylog');const graylog = new Graylog({
address: 'graylog.server.address',
host: 'my-web-project.com',
node: 'dev.log.test',
compress: false
});graylog.log('String line log');
graylog.log({code: 1245, label: 'label'});
graylog.log({code: 1245, label: 'label'}, graylog.level.DEBUG);
graylog.log({code: 1245, label: 'label', level: 6});
graylog.log({code: 1245, label: 'label', level: graylog.level.ALERT});
graylog.log({code: 1245, label: 'label', level: 'error'});graylog.log({
data: ['sss', 'sfdsf', 'sfddsf', {odd: {a: 'a', b: {b: [{a: 'a', b: {a: 'a'}}, 'ss']}}}],
message: 'array data'
});let error;
try {
throw new Error('test error');
} catch (e) {
error = e;
}
graylog.error(error);
graylog.error({message: 'exec test error', error});graylog.info('info');
graylog.debug('debug');
graylog.emergency('emergency');
graylog.alert('alert');
graylog.critical('critical');
graylog.notice('notice');
```## Levels
`graylog.level[levelNameUppercase]`
| code | name | description |
|---|---|---|
| 0 | emergency | system is unusable |
| 1 | alert | action must be taken immediately |
| 2 | critical | critical conditions |
| 3 | error | error conditions |
| 4 | warning | warning conditions |
| 5 | notice | normal, but significant, condition |
| 6 | info | informational message |
| 7 | debug | debug level message |## Constructor
| name | type | default | description |
|---|---|---|---|
| port | number | 12201 | port on server |
| address | string | localhost | Address Graylog server |
| host | string | | client hostname |
| node | string | node | client node name |
| defaultLevel | string/number/Object | INFO | default log level |
| compress | boolean | true | log data compression |