Class RedactionProcessor
java.lang.Object
codes.grow.packages.betterstack.logging.RedactionProcessor
Redacts log records before they are queued.
Attribute names that contain one of the keys (case-insensitive substring) get their
whole value replaced, at any depth of nested maps and lists. The patterns replace their
matches in the body and in every string attribute value.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionDefault sensitive attribute name fragments (SPEC section 4).static final StringDefault replacement text. -
Method Summary
Modifier and TypeMethodDescriptionstatic RedactionProcessor.Builderbuilder()Returns a builder with the defaults.static RedactionProcessordefaults()Returns a processor with the default keys, no patterns and"[REDACTED]".booleanisSensitive(String name) Whether an attribute name matches one of the keys.Returns a redacted copy of the record.Redacts an attribute map (same rules as for record attributes).
-
Field Details
-
DEFAULT_REDACT_KEYS
Default sensitive attribute name fragments (SPEC section 4). -
DEFAULT_REPLACEMENT
Default replacement text.- See Also:
-
-
Method Details
-
defaults
Returns a processor with the default keys, no patterns and"[REDACTED]".- Returns:
- default processor
-
builder
Returns a builder with the defaults.- Returns:
- builder
-
process
Returns a redacted copy of the record.- Parameters:
record- the record- Returns:
- a new, redacted record
-
redactMap
Redacts an attribute map (same rules as for record attributes).- Parameters:
attributes- attributes- Returns:
- redacted copy
-
isSensitive
Whether an attribute name matches one of the keys.- Parameters:
name- attribute name- Returns:
- true when the value must be replaced
-