Merge pull request #294 from Skiggz/gelf-fix
Remove GELF flag when capturing custom fields
This commit is contained in:
commit
c76fe098ae
@ -85,6 +85,8 @@ function gelfAppender (layout, host, port, hostname, facility) {
|
||||
var firstData = data[0];
|
||||
|
||||
if (!firstData.GELF) return; // identify with GELF field defined
|
||||
// Remove the GELF key, some gelf supported logging systems drop the message with it
|
||||
delete firstData.GELF;
|
||||
Object.keys(firstData).forEach(function(key) {
|
||||
// skip _id field for graylog2, skip keys not starts with UNDERSCORE
|
||||
if (key.match(/^_/) || key !== "_id") {
|
||||
|
@ -244,6 +244,7 @@ vows.describe('log4js gelfAppender').addBatch({
|
||||
},
|
||||
'should pick up the options': function(message) {
|
||||
assert.equal(message.host, 'cheese');
|
||||
assert.isUndefined(message.GELF); // make sure flag was removed
|
||||
assert.equal(message._facility, 'nonsense');
|
||||
assert.equal(message._every1, 'Hello every one'); // the default value
|
||||
assert.equal(message._every2, 'Overwritten!'); // the overwritten value
|
||||
|
Loading…
Reference in New Issue
Block a user