pinojs / pino-gelf

🌲 Convert Pino logs to GELF format and send to Graylog
Apache License 2.0
13 stars 10 forks source link

Error thrown when data.msg is undefined. #3

Open nmarus opened 5 years ago

nmarus commented 5 years ago

Occasionally getting this error:

/usr/local/lib/node_modules/pino-gelf/lib/transformer/standard-gelf.js:7
   short_message: data.msg.substring(0, 65),
                           ^
TypeError: Cannot read property 'substring' of undefined
   at module.exports (/usr/local/lib/node_modules/pino-gelf/lib/transformer/standard-gelf.js:7:29)
   at /usr/local/lib/node_modules/pino-gelf/lib/transformer/index.js:9:26
   at DestroyableTransform._transform (/usr/local/lib/node_modules/pino-gelf/lib/pipeline.js:12:23)
   at DestroyableTransform.Transform._read (/usr/local/lib/node_modules/pino-gelf/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
   at DestroyableTransform.Transform._write (/usr/local/lib/node_modules/pino-gelf/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:83)
   at doWrite (/usr/local/lib/node_modules/pino-gelf/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:428:64)
   at writeOrBuffer (/usr/local/lib/node_modules/pino-gelf/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:417:5)
   at DestroyableTransform.Writable.write (/usr/local/lib/node_modules/pino-gelf/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:334:11)
   at Transform.ondata (/usr/local/lib/node_modules/pino-gelf/node_modules/readable-stream/lib/_stream_readable.js:639:20)
   at emitOne (events.js:116:13)
events.js:183
     throw er; // Unhandled 'error' event
     ^
jfahrenkrug commented 5 years ago

I'm getting this too. The tool should not depend on msg being defined I think.