Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some log messages are not accepted by the elastic search, but pino-elasticsearch does not show any error or warning #61

Open
euglv opened this issue Aug 7, 2020 · 2 comments

Comments

@euglv
Copy link

euglv commented Aug 7, 2020

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.

@mcollina
Copy link
Member

mcollina commented Aug 7, 2020

@delvedor wdyt?

@rclayton-godaddy
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants