@chax-at/gelf-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

gelf-client

A simple gelf client for node. Currently supports TCP and TCP/TLS.

Fields are truncated to 1000 characters by default. This is configurable.

Usage

import {SecureTCPTransport, GelfClient} from "gelf-client";

const secureTransport = new SecureTCPTransport({
    host: 'localhost',
    port: 15150,
    ca: fs.readFileSync('server.crt'),      // for self-signed server certs
    key: fs.readFileSync('client.key'),     // for TLS client auth
    cert: fs.readFileSync('client.cert'),   // for TLS client auth
});

const gelfClient = new GelfClient(secureTransport);

// Not required. gelf-client will connect automatically upon send if necessary.
await gelfClient.connect();

await gelfClient.send({
    message: 'This is my message',
    level: 2
}, {
    myPayload1: 2,
    mayPayload2: {
        userId: 1,
        sessionId: 2
    }
});

await gelfClient.disconnect();

Readme

Keywords

none

Package Sidebar

Install

npm i @chax-at/gelf-client

Weekly Downloads

84

Version

1.0.0

License

none

Unpacked Size

27.7 kB

Total Files

31

Last publish

Collaborators

  • jan-chax
  • chartinger
  • simonjimenez
  • ian.luca
  • valerionn