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 |
|---|---|---|
|
| Pattern to match in the serialized JSON payload. |
|
| 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.