3.0.0 • Published 11 months ago

good-hapi-graylog2 v3.0.0

Weekly downloads
47
License
MIT
Repository
github
Last release
11 months ago

good-hapi-graylog2

Good Reporter For Graylog2

Hapi: http://hapijs.com/

Good: https://github.com/hapijs/good

Graylog2: https://www.graylog.org/

Usage:

npm install good-hapi-graylog2

const Good = require('good');
const Hapi = require('hapi');
const pino = require('pino')();

const server = new Hapi.Server();
server.connection({ port: <your_port> });

const goodOptions = {
  includes: {
    request: ['headers'],
    response: ['payload'],
  },
  reporters: {
    logstash: [{
      module: 'good-squeeze',
      name: 'Squeeze',
      args: [{ response: '*', request: '*' }],
    }, {
      module: 'good-hapi-graylog2',
      args: [{
        host: '<graylog server ip>',
        port: '<graylog server port>',
        facility: '<your service name>',
        hostname: '<your host>',
        bufferSize: '<your buffer size>' // optional, default 1400
        adapter: '<protocol udp or tcp>' // optional, default udp
      }],
    }],
  },
};
try {
  server.register([{
      register: good,
      options: goodOptions,
    }], async () => {

    const start = await server.start();
    if (start instanceof Error) throw new Error('Ошибка запуска сервера');

    pino.info('Server running at:', server.info.uri);
  });
} catch((error) => {
  pino.error(error.message)
})

Graylog Setup:

This module requires a GELF_UDP input to be configured on your graylog server.

3.0.0

11 months ago

2.1.0

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.2.0

1 year ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago