Skip to content

Commit

Permalink
Filter username out of payload
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Oct 2, 2020
1 parent 52d3557 commit 08aeaf6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/apm.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ module.exports = function (serviceName = name) {

apmConfig = loadConfiguration(process.argv, ROOT_DIR, isKibanaDistributable);
const conf = apmConfig.getConfig(serviceName);
require('elastic-apm-node').start(conf);
const apm = require('elastic-apm-node');

// Filter out username PII
apm.addFilter((payload) => {
if (payload.context && payload.context.user && payload.context.user.username) {
delete payload.context.user.username;
}

return payload;
});

apm.start(conf);
};

module.exports.getConfig = (serviceName) => {
Expand Down

0 comments on commit 08aeaf6

Please sign in to comment.