GELF appender: move facility key into a custom field if present
At the same time, don't assign a default value as the field is optional according to the GELF spec v1.1.
This commit is contained in:
@@ -48,7 +48,9 @@ function gelfAppender (layout, host, port, hostname, facility) {
|
|||||||
host = host || 'localhost';
|
host = host || 'localhost';
|
||||||
port = port || 12201;
|
port = port || 12201;
|
||||||
hostname = hostname || require('os').hostname();
|
hostname = hostname || require('os').hostname();
|
||||||
facility = facility || 'nodejs-server';
|
if(facility) {
|
||||||
|
customFields['_facility'] = facility;
|
||||||
|
}
|
||||||
layout = layout || layouts.messagePassThroughLayout;
|
layout = layout || layouts.messagePassThroughLayout;
|
||||||
|
|
||||||
var defaultCustomFields = customFields || {};
|
var defaultCustomFields = customFields || {};
|
||||||
@@ -103,7 +105,6 @@ function gelfAppender (layout, host, port, hostname, facility) {
|
|||||||
msg.timestamp = msg.timestamp || new Date().getTime() / 1000; // log should use millisecond
|
msg.timestamp = msg.timestamp || new Date().getTime() / 1000; // log should use millisecond
|
||||||
msg.host = hostname;
|
msg.host = hostname;
|
||||||
msg.level = levelMapping[loggingEvent.level || levels.DEBUG];
|
msg.level = levelMapping[loggingEvent.level || levels.DEBUG];
|
||||||
msg.facility = facility;
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user