Problem
Pino allows configuring the message key via messageKey (e.g., messageKey: 'message'), but pino-gelf hardcodes data.msg in lib/transformer/standard-gelf.js:
if (typeof data.msg === 'string') {
payload.short_message = data.msg.substring(0, 65);
payload.full_message = data.msg;
}
When a user configures Pino with a custom messageKey, the message is serialized under that key instead of msg, so pino-gelf never picks it up. The GELF output ends up with a missing or empty short_message/full_message.
Expected behavior
pino-gelf should support a messageKey option (defaulting to 'msg') and use it when reading the message from log data, similar to how pino-pretty handles this.
Suggestion
Accept a messageKey option and use it in the transformer:
const messageKey = opts.messageKey || 'msg';
if (typeof data[messageKey] === 'string') {
payload.short_message = data[messageKey].substring(0, 65);
payload.full_message = data[messageKey];
}
Problem
Pino allows configuring the message key via
messageKey(e.g.,messageKey: 'message'), butpino-gelfhardcodesdata.msginlib/transformer/standard-gelf.js:When a user configures Pino with a custom
messageKey, the message is serialized under that key instead ofmsg, sopino-gelfnever picks it up. The GELF output ends up with a missing or emptyshort_message/full_message.Expected behavior
pino-gelfshould support amessageKeyoption (defaulting to'msg') and use it when reading the message from log data, similar to howpino-prettyhandles this.Suggestion
Accept a
messageKeyoption and use it in the transformer: