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
const Gelf = const gelf = // with default config gelf
Initialize with custom config
const Gelf = const gelf = graylogPort: 12201 graylogHostname: '127.0.0.1' connection: 'wan' maxChunkSizeWan: 1420 maxChunkSizeLan: 8154
sending Messages
// send just a shortmessagegelf // send a full messageconst message = "version": "1.0" "host": "www1" "short_message": "Short message" "full_message": "Backtrace here\n\nmore stuff" "timestamp": Date / 1000 "level": 1 "facility": "payment-backend" "file": "/var/www/somefile.rb" "line": 356 "_user_id": 42 "_something_else": "foo" gelf;
Events
'error'
Emitted for errors
'gelf.log'
Logs a short or full message
Methods
closeSocket
Closes the UDP Socket
openSocket
Opens the Socket
Tests
npm run test