Class RegexValueMasker
java.lang.Object
net.logstash.logback.mask.RegexValueMasker
- All Implemented Interfaces:
ValueMasker
Masks values based on a regular expression.
-
Constructor Summary
ConstructorsConstructorDescriptionRegexValueMasker(String regex, Object mask) RegexValueMasker(Pattern pattern, Object mask) -
Method Summary
Modifier and TypeMethodDescriptionmask(TokenStreamContext context, Object o) If the given value at the JSON stream context's current path should be masked, then returns the masked value to write as the value..
-
Constructor Details
-
RegexValueMasker
-
RegexValueMasker
-
-
Method Details
-
mask
Description copied from interface:ValueMaskerIf the given value at the JSON stream context's current path should be masked, then returns the masked value to write as the value.. TheMaskingJsonGeneratorwill write the returned masked value as the value (instead of the original value).If the given value at the JSON stream context's current path should NOT be masked, returns null.
- Specified by:
maskin interfaceValueMasker- Parameters:
context- the current JSON stream context, which can be used to determine the path within the JSON output. (could be at a field value path or an array element value path)o- the number or string scalar value to potentially mask (could be a field value or an array element value).- Returns:
- A non-null masked value to write if given value at the JSON stream context's current path should be masked.
Otherwise null if the given value at the JSON stream context's current path should NOT be masked.
To write a JSON null value as the masked value, return
NullNode.instance. To write "****", the returnMaskingJsonGenerator.MASK
-