pino-elasticsearch
pino-elasticsearch copied to clipboard
Some log messages are not accepted by the elastic search, but pino-elasticsearch does not show any error or warning
For example, if different log objects have fields with the same name but with different value type. If we do:
logger.info({ test: 123 });
logger.info({ test: "string value" }); // this log message will not be added
Then the last log message will not be added to the elastic search because of the error: failed to parse field [test] of type [long] in document with id ... but pino-elasticsearch will not output any error or warning.
@delvedor wdyt?
If you look at the code, you will see that Pino Elastic returns an EventEmitter:
const pinoElastic = require('pino-elasticsearch');
const streamToElastic = pinoElastic({
// ...
});
streamToElastic.on('insertError', (error: any) => console.log('ERROR', error));
This will at least let you see what the issue is and bypasses Pino (so it's not aggregated in a loop).