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
Feed the manager with the raw (udp) data received.
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.
function(error) { }
Emitted when an error occurs. This passes an Error
object.
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);