groundcover’s pipelines can be used to protect sensitive data in your Logs and Traces using Vector's redact function. Mask or remove sensitive information while preserving the usefulness of your data.
groundcover’s pipelines can be used to protect sensitive data in your Logs and Traces. With Vector's redact function, you can mask or remove sensitive information while preserving the usefulness of your observability data.
We highly recommend using Vector's built-in function redact for Logs/Traces obfuscation. This powerful function allows you to configure simple yet effective redaction rules to protect sensitive information in your logs and traces.
With redact, you can:
Mask or remove sensitive data from strings, arrays, or objects
Replace text matching specified patterns (like regex) with a placeholder, custom text, or a hash (SHA-2 or SHA-3)
Please refer to the redact function's documentation for more details.
On this page, we'll explore how to leverage the redact function and VRL's capabilities to obfuscate PII in Logs and Traces. At the end of this page, you'll find a handy list of regex patterns to save you time and effort.
In the examples below, we redact both the log contents (.content) and any attributes derived from the structued logs (.string_attributes).
Obfuscate credit card numbers from Logs
In this example, we'll obfuscate Visa credit card numbers from logs using the Visa credit card regex pattern from the library. By not specifying a redactor type, the redact function will default to full redaction, replacing detected numbers with the string “[REDACTED].”
vector:logsPipeline:extraSteps: - name:obfuscateVisaCardstransform:type:remapsource:|- pattern = r'(?:4\d{3}){4}|4\d{7}\d{8}|4\d{12}(?:\d{3})?' # Redact content. Cast to string and redact contentAsString, err = string(.content) if err == null { .content = redact(contentAsString, filters: [pattern]) } # Redact all attributes. Iterate, cast to string, redact .string_attributes = map_values(object!(.string_attributes), recursive:true) -> |value| { asString, err = string(value) if err == null { redact(asString, filters: [pattern]) } else { value } }
Here's an example of how Logs appear before and after obfuscation:
In this example we’ll hash of all US Social Security Numbers hidden in logs. We’ll pass the sha2 parameter to the redactor to hash the sensitive values.