This example provides an application that applies a url obfuscation rule to scrub email adddresses from external http calls using fetch
.
- Clone or fork this repository.
- Navigate to this example's sub directory
cd newrelic-node-examples/custom-instrumentation/url-obfuscation
- Install dependencies and run application.
npm install cp env.sample .env # Fill out `NEW_RELIC_LICENSE_KEY` in .env and save # Start the application npm start
- The application will make a call to
https://httpbin.org/anything/[email protected]
- It will apply the url obfuscation rules from newrelic.js
url_obfuscation: {
enabled: true,
regex: {
pattern: '[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}',
replacement: '***'
}
}
- This will obfuscate the email address from both the span name and the
http.url
span attribute.
This shows the span name obfuscates the email from the span name:
This shows the http.url
span attribute obfuscates the email: