• /
  • EnglishEspañolFrançais日本語한국어Português
  • Inicia sesiónComenzar ahora

Browser obfuscation rules

Obfuscation rules let you mask sensitive data before the agent transmits it to New Relic. Each rule is a regex pattern paired with a replacement string. Rules are applied to the serialized JSON payload before transmission.

Configuration

Pass an obfuscate array in the agent configuration:

config: {
obfuscate: [
{ regex: /\/user\/[^\/?"]+/, replacement: '/user/[REDACTED]' },
{ regex: /token=[^&"]+/, replacement: 'token=[MASKED]' },
]
}

Parameters

Field

Type

Description

regex

string | RegExp

Pattern to match in the serialized JSON payload.

replacement

string

Replacement string for each match.

Rule ordering

Rules are applied sequentially — the output of one rule feeds into the next. Invalid regex patterns are skipped with a warning logged via Log.warn.

Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.