diff --git a/lib/plugins/output/gelfout.js b/lib/plugins/output/gelfout.js index d32a823e..4be81f1f 100644 --- a/lib/plugins/output/gelfout.js +++ b/lib/plugins/output/gelfout.js @@ -8,15 +8,20 @@ function OutputGELF (config, eventEmitter) { this.compression = config.compression || 'deflate' this.chunkSize = config.chunkSize || 1024 this.eventEmitter = eventEmitter + this.log = graygelf({ + host: this.config.host, + port: this.config.port, + compressType: this.compression, + chunkSize: this.chunkSize + }) } OutputGELF.prototype.eventHandler = function (data, context) { if (this.config.debug) { console.log('context ' + JSON.stringify(context)) } - var log = graygelf({host: this.config.host, port: this.config.port, compressType: this.compression, chunkSize: this.chunkSize}) var rawMessage = this.mapData(data, context) - log.raw(rawMessage) + this.log.raw(rawMessage) } OutputGELF.prototype.mapData = function (data, context) {