@kmihaltsov/lambda-powertools-pattern-obfuscate v1.29.0
lambda-powertools-pattern-obfuscate
A pattern that helps you follow our guidelines around logging and monitoring. With added ability to obfuscate personal fields.
Main features:
configures Datadog metrics namespace using the function name if one is not specified already
configures Datadog default tags with
awsRegion,functionName,functionVersionandenvironmentapplies the
@kmihaltsov/lambda-powertools-middleware-correlation-idsmiddleware at a default 1% sample rateapplies the
@kmihaltsov/lambda-powertools-middleware-sample-loggingmiddleware at a default 1% sample rateapplies the
@kmihaltsov/lambda-powertools-middleware-obfuscated-loggingmiddleware with passed obfuscation filtersapplies the
@kmihaltsov/lambda-powertools-middleware-log-timeoutmiddleware at default 10ms threshold (i.e. log an error message 10ms before an invocation actually times out)allow override for the default 1% sample rate via a
SAMPLE_DEBUG_LOG_RATEenvironment variable, to sample debug logs at 5% rate then setSAMPLE_DEBUG_LOG_RATEto0.05
Getting Started
Install from NPM: npm install @kmihaltsov/lambda-powertools-pattern-obfuscate
API
const obfuscatedWrap = require('@kmihaltsov/lambda-powertools-pattern-obfuscated')
module.exports.handler = obfuscatedWrap.obfuscaterPattern(['Records.*.firstName', 'Records.*.lastName'], async (event, context) => {
return 42
})3 years ago