pino: logging large JSON content causes cutting off the log payload

We log request and response bodies in our development stages for debugging purposes. If content of a log message/payload is bigger then 64 KB, we don’t get entire message/payload. Somehow either node.js via stdout or pino somewhere cuts off this payload.

Reproducable script:

const P = require("pino");
const fs = require("fs");
const content = fs.readFileSync('./data.txt').toString('utf-8');
const logger = P({ level: 'debug' });
logger.debug(content);

Please download JSON file below (generated using an online tool): data.txt

We use latest Version of Pino.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 52 (28 by maintainers)

Most upvoted comments

@nodify-at as soon as you confirm that the branch is working as expected. There is still an outstanding comment about _buf.

Thanks for your fix but the entire log disappears after using your changes. I’m trying to find out why they disappear and let you know

Fixes to that code are highly welcome. The logic should be roughly there.

That is helpful. I’ll take a look asap.

@mcollina I can’t reproduce it in my local environment. I’m trying to analyse ELK Stack, if I find something, I will let you know

yeah I think so - closing as this isn’t an issue with pino, good luck!