Kibana version:
6.5.4
Elasticsearch version:
6.5.4
APM Server version:
6.5.4
APM Agent language and version:
elastic-apm-node 2.5.1
Browser version:
Google Chrome
Version 73.0.3683.86 (Official Build) (64-bit)
Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Docker community images
Fresh install or upgraded from other version?
Fresh install
Is there anything special in your setup?
For testing purposes I am running my Node.js app locally that is sending metrics to the apm server behind an AWS ALB.
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I am using express ^3.21.2 and trying to to send back the response body via the setCustomContext
method. However the data seems to be truncated around character 578. I assume there is a max number of characters that can be sent. Is there a way to override the default limit. In the screenshot below take a look in responseData
the characters are cut off at the key "fil
(key should be filterField
)
Here is the code I am using to send back the response.
app.use (function (req, res, next) {
const oldWrite = res.write;
const oldEnd = res.end;
const chunks = [];
res.write = (...restArgs) => {
chunks.push(Buffer.from(restArgs[0]));
oldWrite.apply(res, restArgs);
};
res.end = (...restArgs) => {
if (restArgs[0]) {
chunks.push(Buffer.from(restArgs[0]));
}
const body = Buffer.concat(chunks).toString('utf8');
let customData = {
time: new Date().toUTCString(),
fromIP: req.headers['x-forwarded-for'] ||
req.connection.remoteAddress,
method: req.method,
originalUri: req.originalUrl,
uri: req.url,
requestData: req.body,
responseData: body,
referer: req.headers.referer || '',
ua: req.headers['user-agent']
};
apm.setCustomContext({
responseBody: customData
});
console.eyes(customData);
// console.log(body);
oldEnd.apply(res, restArgs);
};
next();
});
Steps to reproduce:
Use the JS code above in your express app and send back large response (over 578 characters) to the setCustomContext
method.