Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
gelf-node is a full implementation for sending messages in GELF (Graylog Extended Log Format) from node.js
tree: 8255063209

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.npmignore
.travis.yml
LICENSE
Makefile
README.markdown
gelf.js
package.json
test.js

README.markdown

build status

gelf-node

gelf-node is a full implementation for sending messages in GELF (Graylog Extended Log Format) from node.js

Install

npm install gelf

Example Usage

Initialize with defaults

var Gelf = require('gelf');
gelf = new Gelf(); // with default config

Initialize with custom config

var Gelf = require('gelf');
gelf = new Gelf({
  graylogPort: 12201,
  graylogHostname: '127.0.0.1',
  connection: 'wan',
  maxChunkSizeWan: 1420,
  maxChunkSizeLan: 8154
});

sending Messages

//send just a shortmessage
gelf.emit('log', 'myshortmessage');

//send a full message
var message = {
  "version": "1.0",
  "host": "www1",
  "short_message": "Short message",
  "full_message": "Backtrace here\n\nmore stuff",
  "timestamp": 1291899928.412,
  "level": 1,
  "facility": "payment-backend",
  "file": "/var/www/somefile.rb",
  "line": 356,
  "_user_id": 42,
  "_something_else": "foo"
};

gelf.emit('log', message);

Tests

make
Something went wrong with that request. Please try again.