• /
  • Log in
  • Free account

Hash or mask sensitive data in your logs (obfuscation)

With log obfuscation rules, you can prevent certain types of information from being saved in New Relic.


Log obfuscation is planned to be available in June, 2022, as part of our Data Plus offering. For more information, talk to your account representative.


After logs have been shipped to New Relic, any sensitive information in the logs can be obfuscated before being stored in NRDB, our New Relic database, by using obfuscation rules.

Sensitive information might include personally-identifiable information such as credit card numbers, Social Security numbers, national IDs, or other data that you may be required by regulation to protect when stored.

You can define regular expressions matching your sensitive information, and then create rules to obfuscate that data. You can choose either to have sensitive information masked or hashed.


  • Obfuscation rules define what logs to apply obfuscation actions to.
  • Obfuscation rule actions define what attributes to look at, what text to obfuscate, and how to obfuscate (either by masking or hashing).
  • Obfuscation expressions are named regular expression identifying what text to obfuscate.
  • Masking completely removes information, replacing it with X characters. You cannot search for specific values once this is done.
  • Hashing hides information. You can use the hashing tool to get the hash of a sensitive value, and then search for logs containing that hash.

How obfuscation works

Watch this video (less than 4 minutes) to see how obfuscation works in the New Relic UI.

The JSON objects displayed in the following example are simplifications of the payloads used in the Obfuscation API. This will help you better correlate the different API operations with their UI equivalent counterparts.

Example: Log record before obfuscation

Imagine you have the following log record:

"message": "The credit card number 4321-5678-9876-2345 belongs to user user@email.com (born on 01/02/2003) with SSN 123-12-1234",
"creditCardNumber": "4321-5678-9876-2345",
"ssn": "123-12-1234",
"department": "sales",
"serviceName": "loginService"

This log record contains several sensitive data. Ideally, you would like your log to end up looking like this:

"message": "The credit card number 9aa9bc1528859aee1b1df75795f1ebd54beb2f0d26c8a1d4580a71a07189cdd5 belongs to user user@email.com (born on XXXXXXXXXX) with SSN 30e6897f76dc102e32ee1d781c43417d259e586eac15c963d75ab8b5187769da",
"creditCardNumber": "9aa9bc1528859aee1b1df75795f1ebd54beb2f0d26c8a1d4580a71a07189cdd5",
"ssn": "30e6897f76dc102e32ee1d781c43417d259e586eac15c963d75ab8b5187769da",
"department": "sales",
"serviceName": "loginService"

Example: Basic process

Here is the basic process you would use to obfuscate the sensitive data in this example.

Checklist: Steps to obfuscate logs

To obfuscate your logs:

  1. Study the shape of your logs by identifying patterns of sensitive data that appear in them. For example:
  • Do all your logs contain sensitive information? Or can you be more specific (only the logs from service A or region B)?
  • What sensitive information do they contain: credit card numbers, driver's license numbers, national IDs, biometrics, other values?
  1. Create obfuscation expressions to identify how to extract sensitive data.
  2. Define obfuscation rules for each set of logs:
  • Define how you will capture them using NRQL.
  • Define which obfuscation actions need to be applied to each of them. Ask yourself: Will I need to query my logs using this sensitive information later (consider using HASH), or do I need to remove this information entirely from my logs (consider using MASK)?


The Logs Obfuscation UI includes a Hashing tool so that you can find a hash from a known value and copy it for use with other expressions and rules.

CPU limits

Obfuscation has per-minute CPU limits. If your account hits your resource limits, logs won't be obfuscated as expected. To check your CPU limits, go to your system Limits page in the New Relic Data management UI.

You can also use the Health tab in the Logs Obfuscation UI to evaluate how well your obfuscation rules are working, which are being skipped, and whether they need any fine-tuning. Obfuscation rules are CPU intensive, so these charts can help you decide which rules are most impacted by any resource limitations.

Obfuscation expressions

You can create, read, update, or delete obfuscation expressions by using the New Relic UI or by using NerdGraph, our GraphQL Explorer.

Screenshot of Logs obfuscation expressions UI

one.newrelic.com > Logs > Obfuscation: First create one or more obfuscation expressions, then create your obfuscation rules.

Obfuscation rules

You can create, read, update, or delete obfuscation rules by using the New Relic UI or by using NerdGraph, our GraphQL Explorer.

Create issueEdit page
Copyright © 2022 New Relic Inc.