Scrub PII from Application and Server Logs
Logs record everything your application does, including things it shouldn't. Request logs capture caller IPs and auth headers. Error logs include stack traces with internal hostnames. Access logs record user email addresses used as identifiers. Debug logs often include full request bodies with customer data embedded.
Sharing application logs for debugging, incident response, or vendor support tickets is one of the most common accidental PII disclosure paths. The scrubber removes the identifiable values from log text before it leaves your environment, letting you share the operational signal without the sensitive context.
PII patterns in application logs
Web server access logs include client IP addresses on every line. Application logs at INFO and DEBUG level frequently include user identifiers, often email addresses used as usernames. Error logs catch full exceptions that include database connection strings in the message, internal hostnames in the stack trace, and auth tokens in HTTP header dumps.1 Consequently, a simple log grep for an error message can return a file that, pasted verbatim into a support ticket or AI debugging session, exposes dozens of sensitive values. The scrubber reduces a raw log to its operational signal.
You should assume that any production log file contains PII until you verify otherwise. Even logs from internal-only services can contain developer email addresses in authentication contexts, internal IP addresses in connection metadata, and API keys in configuration dumps. The scrubber processes log text line by line, detecting all 22 PII patterns regardless of which log format you use.2 A 10,000-line log file is scrubbed in the same time it takes to paste it, so there is no practical reason to skip the scrub step even for large log exports.
Log formats the scrubber handles
The scrubber works on plain text, so it handles any log format: Apache/Nginx combined log format (IP at the start of each line), JSON log output (structured fields), Python exception tracebacks (connection strings in the message), Node.js application logs (email identifiers in user objects), and CI/CD pipeline output (auth tokens in environment variable dumps). Furthermore, OpenTelemetry traces exported as text or NDJSON are processed the same way as any other structured text, with field-level tokenization and no structure loss.1
You do not need to reformat your logs before scrubbing. Paste them exactly as they appear in your log viewer, terminal, or log aggregation tool. The scrubber detects PII patterns in raw text, so formatting differences such as colored output, timestamp prefixes, or structured field labels do not affect detection accuracy. If your logs include ANSI color codes from terminal output, the scrubber processes them as part of the text and detects PII patterns around them without any preprocessing needed.
Safe log sharing practices
After scrubbing, the log file is safe to share with vendors, AI debugging tools, or external support channels. The variables file maps each token back to its original value, so your internal team can cross-reference the shared log against the real values without reconstructing them manually. Building on this, scrubbed logs can safely be stored in shared incident management systems like Jira or GitHub Issues where broader team access is expected. Yet the variables file itself should stay restricted, and you should treat it with the same access control as the original log.
You should establish a clear retention policy for variables files generated from log scrubbing. The variables file is the key that reconstructs the original log content, so it carries the same sensitivity classification as the original log. For incident response workflows, store the variables file in the same secure location where you would store the original log export. When the incident is resolved and the log is no longer needed, delete the variables file alongside the log export. Treating the variables file as a transient artifact rather than a permanent record keeps your data lifecycle consistent.
Structured logging frameworks and PII propagation
Structured logging frameworks (Winston, Bunyan, Logstash, Datadog Agent) emit log lines as JSON objects with consistent field schemas.3 These frameworks add session context to every log line for a given request: a middleware that logs the authenticated user's email with the first event of a session propagates that email to every subsequent log line in the same session. A single user action can generate dozens of log lines, each inheriting the email address as a field value.
The scrubber processes structured JSON log output (NDJSON) the same way it processes any text: paste the log export and all field values matching PII patterns are tokenized across every line. A session with 200 log lines sharing the same user email produces a single [EMAIL_1] token that represents the email across all 200 lines in the output. The variables file stores the mapping once, keeping the token-to-value reference compact regardless of how many log lines contained the original value.
Log enrichment pipelines and PII amplification
Log enrichment pipelines (used in ELK Stack, Splunk, and Datadog) add geolocation data, user profile fields, and organization metadata to raw log lines as they pass through the pipeline.4 An access log line containing only a client IP address may exit the enrichment pipeline with that IP resolved to a user email, name, and account ID. Logs exported after enrichment carry significantly more PII per line than raw logs. Identify whether your logs have been enriched before scrubbing, and if so, expect more PII fields per line and a larger variables file.
Shipping log excerpts to vendor support and AI tools
Vendor support tickets for infrastructure products (Datadog, AWS, Cloudflare, PagerDuty) routinely require log excerpts to diagnose issues. These platforms' support teams are third parties under most data governance frameworks, which means sharing logs containing customer IP addresses or user emails with vendor support requires either a data processing agreement or removal of the PII from the excerpt.
Scrubbing the relevant log lines before attaching them to a support ticket satisfies both requirements simultaneously: the vendor receives the operational signal they need to diagnose the issue (error codes, timestamps, response codes, stack trace structure) without receiving any customer identifiers. After the ticket is resolved, you can restore the real values from the variables file if you need to reconstruct the full incident timeline internally.
Incident response workflows and scrubbed log handoffs
During an active incident, speed is critical and scrubbing can feel like a delay. Establish a pre-scrub step as part of your standard handoff procedure rather than an ad-hoc decision under pressure. A runbook section titled "Before sharing logs externally" that references the scrubber URL makes the step routine rather than optional. Scrub a 50-line excerpt under time pressure in under 30 seconds; building the habit eliminates a category of PII exposure that otherwise occurs most frequently during the high-pressure moments when careful review is hardest.
Less-obvious PII patterns in application logs
Beyond IP addresses and email addresses, application logs contain PII in less-obvious forms. HTTP Authorization headers logged in request middleware include Bearer tokens and Basic auth credentials encoded in base64. User-agent strings from misconfigured client libraries occasionally include email addresses or user IDs. Full request body logging at DEBUG level records whatever the user submitted: a search query, a form field, or a free-text comment that may contain names, contact information, or health details.
Review your logging configuration for any middleware or interceptor that logs request headers, full request bodies, or raw query strings. These are the sources of the least-expected PII in your logs. For logs from these sources, the scrubber catches the structured patterns (IPs, emails, auth tokens) but cannot catch free-form user-submitted text that does not match a known pattern. For high-sensitivity applications, review the scrubbed output manually for any user-submitted prose fields that may contain personal information beyond what the pattern matching caught.
Authorization token logging and the JWT detection scope
Bearer tokens in Authorization header logs often contain JWTs with user identity claims embedded in the payload. The scrubber's JWT detection covers the eyJ prefix plus the complete three-segment token structure, so JWTs logged in any field are tokenized regardless of how they appear in the log line.5 Basic auth credentials logged as Authorization: Basic <base64> are not in the default detection set because base64 strings without the JWT prefix do not match the JWT pattern; remove or redact Basic auth header values manually if they appear in your logs.
Because the scrubber runs in your browser with no server upload, the log text you scrub never leaves your machine during processing. For the Basic auth values the JWT pattern misses, a quick manual redaction before pasting closes the remaining gap, and the variables file then holds the only mapping back to the real credentials for safe restoration.
When to use this
Use this before sharing application logs, access logs, or error traces with vendors, support teams, AI debugging tools, or any system outside your internal network.
Examples
Nginx access log with client IPs
192.168.1.10 - [email protected] [01/Jun/2026] "GET /api/data HTTP/1.1" 200 10.0.0.5 - [email protected] [01/Jun/2026] "POST /api/auth HTTP/1.1" 200
[IP_1] - [EMAIL_1] [01/Jun/2026] "GET /api/data HTTP/1.1" 200 [IP_2] - [EMAIL_2] [01/Jun/2026] "POST /api/auth HTTP/1.1" 200
Python traceback with connection string
psycopg2.OperationalError: could not connect to server: postgres://admin:[email protected]/main File "db.py", line 42, in connect
psycopg2.OperationalError: could not connect to server: [DBURL_1] File "db.py", line 42, in connect
The stack trace context (file name and line number) is preserved while the connection string is tokenized.
- 1.
Apache HTTP Server, "Log Files," httpd.apache.org, accessed June 2026. https://httpd.apache.org/docs/2.4/logs.html
- 2.
Microsoft, "Supported entities," microsoft.github.io, accessed June 2026. https://microsoft.github.io/presidio/supported_entities/
- 3.
Trent M. node-bunyan, "log.child," github.com, accessed June 2026. https://github.com/trentm/node-bunyan/blob/master/README.md
- 4.
Datadog, "Lookup Processor," docs.datadoghq.com, accessed June 2026. https://docs.datadoghq.com/logs/log_configuration/processors/lookup_processor/
- 5.
M. Jones, J. Bradley, and N. Sakimura, "JSON Web Token (JWT)," RFC 7519, IETF, May 2015. https://www.rfc-editor.org/rfc/rfc7519.html