@reallyuseful/logger-transport-gelf
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.2 • Public • Published

@reallyuseful/logger-transport-gelf

Logging transport for GELF/Graylog

This is a logging transport for @reallyuseful/logger.

It logs to a GELF server (the protocol used by Graylog).

const { Logger, ConsoleTransport } = require('@reallyuseful/logger');
const { GelfTransport } = require('@reallyuseful/logger-transport-gelf');

// log to Graylog and to the console
const gelfTransport = new GelfTransport({ appName: 'myApp' });
const consoleTransport = new ConsoleTransport();

const myLogger = new Logger([gelfTransport, consoleTransport]);

Options for GelfTransport

GelfTransport can be customized with the following options:

Options for connecting to the GELF/Gryalog server

  • host (string): the GELF or Graylog host (default: localhost)
  • port (number): TCP or UDP port number (default: 12201)
  • protocol (udp, tcp, or tcp-tls): whether to use UDP, TCP, or TCP with TLS encryption (default: udp)
  • ipVersion (4 or 6): must be set if your GELF host is on IPv6 (default: 4)
  • tcpTimeout (number): if using a tcp protocol, the timeout in milliseconds (default: 4000 milliseconds)
  • caCert (string): if using tcp-tls and a self-signed certificate, the certificate of the CA that issued it, in PEM format

Options that identify your app

  • source (string): your app’s hostname (default: os.hostname())
  • appName (string): your app’s name, passed as the appName value to GELF
  • appVersion (string): your app’s version number, passed as the appVersion value to GELF
  • env (string): the environment (such as "development" or "production") in which your app is running (default: the value of the NODE_ENV environment variable)

Options for modifying messages to be logged

  • transform (function): an optional function that can modify messages just before they are sent to GELF. Receives (message, meta) as input and must return an object { message, meta } with the modified values.

Other options

  • minimumSeverity (Level): if specified, messages lower than this severity will not be logged to this transport

Package Sidebar

Install

npm i @reallyuseful/logger-transport-gelf

Weekly Downloads

0

Version

1.0.0-alpha.2

License

MIT

Unpacked Size

82.3 kB

Total Files

21

Last publish

Collaborators

  • natesilva