Skip to content

nail/node-gelf-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-gelf-manager

Manages raw GELF messages.

This module is an EventEmitter, you feed it with raw messages (GZIP'd, ZLIB'd or Chunked) and it will emit a 'message' whenever there's one ready to handle

Methods

GELFManager.feed(buffer)

Feed the manager with the raw (udp) data received.

Events

Event: 'message'

function(data) { }

The 'message' event emits a js object (parsed JSON) when the manager has re-assembled the chunks (if needed) and uncompressed the data.

Event: 'error'

function(error) { }

Emitted when an error occurs. This passes an Error object.

Sample Server

server.js

var dgram = require('dgram');
var GELFManager = require('gelf-manager');

var server = dgram.createSocket('udp4');
var gelfManager = new GELFManager({ debug: true }); 

server.on('message', function (msg, rinfo) {
  gelfManager.feed(msg);
});

gelfManager.on('message', function(msg) {
  console.log(msg);
});

gelfManager.on('error', function(err) {
  console.log(util.inspect(err));
});

server.on("listening", function () {
  var address = server.address();
  console.log("server listening " + address.address + ":" + address.port);
});

server.bind(12201);

About

Raw GELF messages handling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published