Pino: Asynchronous Logging with Pino-ElastichSearch

Created on 22 May 2020  路  3Comments  路  Source: pinojs/pino

Hi,
I have just read documentation about Asynchronous Logging. I see that it's great for improving performance. I'm working with pino-elasticsearch so I wonder how can I config async with pino-elasticsearch. I try to put instace of pino-elasticsearch into dest like this:

const logger = Pino(
    { level: "info" },
    Pino.destination({
        dest: streamToElastic,
        minLength: 4096,
        sync: false
    })
);

but It doesn't work.
Thanks for any helps

Most helpful comment

Yeah, using pino-elasticsearch there should work!
@mcollina the latest version of the client offers a bulk indexer that works with streams, I'll work on a pr for using it, it should improve the performances and the memory consumption ;)

All 3 comments

streaming to ES is already asynchronous by nature. There is no need to use pino.destination().

cc @delvedor

Yeah, using pino-elasticsearch there should work!
@mcollina the latest version of the client offers a bulk indexer that works with streams, I'll work on a pr for using it, it should improve the performances and the memory consumption ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

P4sca1 picture P4sca1  路  4Comments

acro5piano picture acro5piano  路  3Comments

afgallo picture afgallo  路  4Comments

sachinavinaw picture sachinavinaw  路  7Comments

callumlocke picture callumlocke  路  4Comments