How do you scrub PII from logs in the pipeline?
IntermediateProductionLog Pipelines
Answer
Do it as early as possible, ideally in the app (do not log it), with a safety net in the pipeline. Example Vector transform:
[transforms.scrub]
type = "remap"
inputs = ["k8s_logs"]
source = '''
.message = redact(string!(.message), filters: [r'\b[\w.+-]+@[\w-]+\.[\w.]+\b', r'\b(?:\d[ -]?){13,16}\b'])
del(.authorization)
del(.password)
'''
The OTel Collector has the redaction and transform processors for the same job. Test patterns against sample logs in CI and audit the stored data periodically.
More on Log Pipelines
What does a production log pipeline look like end to end?BeginnerWhy structured (JSON) logging, and what fields should every log line have?BeginnerFluent Bit, Vector, Grafana Alloy or the OpenTelemetry Collector: how do you choose a log agent?IntermediateWhy add an aggregation tier instead of sending directly from agents to the backend?IntermediateHow do you design log retention tiers?IntermediateHow and when do you sample logs?Intermediate