Skip to content

Instantly share code, notes, and snippets.

@neillfontes
Created January 18, 2021 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neillfontes/a282afcf29b7f4ef469a5d8660089f51 to your computer and use it in GitHub Desktop.
Save neillfontes/a282afcf29b7f4ef469a5d8660089f51 to your computer and use it in GitHub Desktop.
Logback redact log entries

Use this pattern to match and replace a single bit of information from the logs:

<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'(?&lt;=That-Important-Token:).*', '[REDACTED]'}%n</pattern>

The following can be used to augment for multiple matching instead of adding multiple nested replace() statements that would look off

(?>That-Token|Whatever|GDPR).\K.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment