Log File Anonymizer
Operator: Abdulla Al Fahad. How tools are built and checked
A raw application log is rarely safe to send to a vendor. It holds client IP addresses, session tokens in query strings, email addresses on login lines and the odd password echoed by a debug flag, and pasting it into a ticket hands all of that to everyone who can read the ticket. This page swaps those values for pseudonyms and keeps the log usable. The same original always becomes the same replacement within a run, so 203.0.113.7 is 10.0.0.1 on every line and you can still follow one client through a sequence of requests.
Key features
- Nine built-in rules: IPv4, IPv6, email, JWT, API keys and secrets, card numbers, MAC addresses, hostnames and user IDs
- Consistent pseudonyms, with IPv4 kept in IP shape (10.0.0.n) so parsers still accept the line
- Optional /24 subnet preservation: 10.1.2.3 and 10.1.2.9 become 10.1.2.1 and 10.1.2.2
- Your own regular expressions as name => pattern lines, plus an extra list of hostnames matched as whole words
- Before and after view of the first 300 lines, with a changed-lines-only filter
- An optional mapping CSV of every original and its replacement, and support for .gz logs
What each rule matches, and what it leaves alone
IPv4 means four dotted numbers from 0 to 255 that are not glued to other digits; 127.x.x.x, 0.0.0.0 and 255.255.255.255 are left alone unless you untick that option. An IPv6 candidate must be a valid address, so a time such as 12:30:45 is not mistaken for one, and an IPv4-mapped form such as ::ffff:192.168.10.77 is replaced whole, so none of its octets survive.
A card number is 13 to 19 digits that start like a Visa, Mastercard, Amex, Discover, JCB, UnionPay or Diners number and pass the Luhn check, which keeps a 13-digit millisecond timestamp out.
Key rules cover AWS access key IDs (AKIA and ASIA), GitHub, Slack, Stripe and Google keys, sk- keys, Bearer and Basic credentials, and the value after password=, token=, secret=, api_key= and similar names. A hostname is a dotted name ending in a common TLD (com, net, org, io, dev, local, internal and others) with no further dotted part after it, so java.net.SocketException survives.
User IDs are the value after user=, uid=, login= or account_id= and the user in SSH lines such as Failed password for invalid user admin from.
How it works
Each enabled rule scans a line once and returns its matches with a priority, and overlaps are settled before anything is replaced: custom patterns first, then JWTs, key formats, Bearer values, secret=value pairs, emails, cards, MAC addresses, IPv6, IPv4, hostnames and user IDs. Because the line is rebuilt in one pass, a pseudonym such as user0001@example.invalid is never scanned again.
A file is read as a stream, decoded as UTF-8 with the partial line at each chunk boundary carried over, and processed in slices of about 40 ms so the page stays responsive and Cancel works. Output is gathered as Blob parts of about 4 MB instead of one string. A line over 200,000 characters is removed rather than scanned, because a value inside it could otherwise slip through unchecked.
Pseudonyms come from a counter per type: user0001@example.invalid, host0001.example.invalid, user_0001, [JWT_0001], [KEY_0001], [CARD_0001], 02:00:00:00:00:01 for MACs and fd00::1 for IPv6. One run can hold 2,000,000 distinct values before it stops with a message.
Common use cases
- A support engineer attaches a 90 MB nginx log to a vendor ticket. Client addresses become 10.0.x.x and query-string tokens become [JWT_...] or [KEY_...], and the engineer keeps the mapping CSV locally to turn the vendor's question about 10.0.0.14 back into a real client.
- A security team shares an auth.log excerpt with a university course and keeps each /24 subnet, so students see that 40 failed logins came from one network while the last number still hides every host.
- A developer hides order numbers matching ORD-\d{6} and session cookies matching sid=[a-f0-9]{32} with two custom lines, because neither looks like anything in the built-in rules.
How to use this tool
- Paste log text, or switch to Log file and drop a .log, .txt or .gz file (up to 600 MB, or 150 MB for a .gz).
- Tick the rules you want, add hostnames to the extra list and write any custom patterns, one per line.
- Press Anonymize. For a file a progress bar and a Cancel button appear.
- Compare the before and after panes and read the counts per type.
- Download the anonymized log, and the mapping CSV only if you need to translate a pseudonym back later.
Example
Two lines of a web log
203.0.113.7 - alice [10/Mar/2026:13:55:36 +0000] "GET /account?user_id=48213&token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0ODIxMyJ9.c2lnbmF0dXJl HTTP/1.1" 200 512 "https://shop.acme-demo.com/cart"
203.0.113.7 - - [10/Mar/2026:13:55:41 +0000] "POST /login HTTP/1.1" 302 0 "-" email=alice@acme-demo.com password=hunter22!After anonymizing with the default rules (7 replacements, 6 distinct values)
10.0.0.1 - alice [10/Mar/2026:13:55:36 +0000] "GET /account?user_id=user_0001&token=[JWT_0001] HTTP/1.1" 200 512 "https://host0001.example.invalid/cart"
10.0.0.1 - - [10/Mar/2026:13:55:41 +0000] "POST /login HTTP/1.1" 302 0 "-" email=user0001@example.invalid password=[KEY_0001]Tips for best results
- Every limit the page applies is reported above the result, such as extra hostnames past the first 200, so a clean-looking output never hides a partial run. A line with tens of thousands of matches is fully replaced.
- Switch on subnet preservation only when the reader needs to know whether traffic came from one network. It leaves the first three numbers of every address visible, so it discloses the networks themselves.
- Write custom lines before you run a whole file. A pattern that can match empty text is refused, and the first 300 lines in the preview show quickly whether a pattern is too greedy.
Common pitfalls
Rules find values by their shape, not their meaning. A name in a free-text sentence, the user name in the third field of a common-format access log (alice in the example above) and a street address are not matched; add them as custom patterns or extra hostnames before you share the file.
A private key block (-----BEGIN PRIVATE KEY-----) spans several lines and is not matched, and neither is a secret with no recognizable prefix and no name such as password= in front of it. Read the preview, then search the output for the strings you most need gone.
Common errors and how to fix them
- "Custom pattern on line 2 matches empty text, so it would match everywhere."
- A pattern such as \d* or (a)? can match nothing, which would insert a pseudonym between every character. Use + instead of *, or add a literal prefix.
- "More than 2,000,000 distinct values were found, so anonymizing stopped"
- Every distinct original is held in memory so it can get the same pseudonym again. A custom pattern that matches something unique on every line, such as a request ID, reaches the cap; narrow the pattern or split the file.
Best practices
- Anonymize a copy and keep the original under its existing access controls. The output hides values but keeps timestamps, paths and message text, which can still identify a person in context.
- Before the file leaves your hands, search it for the few strings that matter most, such as a customer name or an internal domain.
What the mapping CSV is for
The mapping CSV has three columns, type, original and replacement, with one row per distinct value. It lets you answer a follow-up such as what happened to user_0007 without keeping the raw log open. It also contains every secret that was removed, so store it as carefully as the original.
Large files and compressed logs
A plain-text log of up to 600 MB is processed as it streams in, so memory holds the output and the mapping rather than the whole input as one string. A .gz file is inflated by the browser's own DecompressionStream, limited to 150 MB compressed and 600 MB of decompressed text, and shows Reading instead of a percentage because the final size is not known.
Other archive formats (.zip, .bz2, .zst) are not read. A plain file is refused as binary on its first 8 KB, and a .gz file is checked the same way on its first decompressed bytes.
Frequently asked questions
Does a value keep the same pseudonym between two runs?
No. Counters restart at 1 for each run, so 203.0.113.7 may be 10.0.0.1 today and 10.0.0.5 tomorrow. If two files must agree, join them first and anonymize them as one file.
How is this different from Anonymize CSV here?
Anonymize CSV replaces whole columns of a table with tokens. A log has no columns, so this page finds values inside free text by their pattern and leaves the rest of the line intact.
Can someone with only the anonymized log work out the originals?
Not from the replacements: they are counters, not hashes or encryptions of the original. Subnet preservation is the exception, because it leaves each address's first three numbers in plain view.