@chax-at/gelf-client
v1.0.0
Published
A simple gelf client for node. Currently supports TCP and TCP/TLS.
Downloads
170
Keywords
Readme
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();