How a log line becomes a shape
Fingerprinting is the entire system and it fails in two opposite directions. Strip too little and every line is unique, so nothing ever has a history. Strip too much and two genuinely different errors become the same shape, so one of them can never be seen.
Key takeaways
- Strip numbers, identifiers, timestamps, paths, quoted values and stack line numbers.
- Never strip the exception type, the message text, or the function name.
- Structured logs make this nearly free: the fingerprint is the event name plus the level.
- Too many shapes means something variable is not being stripped.
- Too few means two different errors have collapsed, which is the dangerous direction.
What gets stripped
before Order 84412 failed after 1203ms: timeout contacting
https://api.example.com/v2/rates?zone=EU
after Order failed after ms: timeout contacting
stripped numbers, identifiers, durations, URLs, quoted strings,
UUIDs, IP addresses, hex blobs, stack line numbers, dates
kept every word, the exception type, the function name, the level
The rule is that anything which varies between two occurrences of the same event is stripped and everything that identifies which event it is stays. Written down like that it is obvious; the difficulty is entirely in the long tail of things that vary and do not look like numbers.
The two failure modes
- App integration
- Machine learning
- Security & identity
- Management
- Analytics
Under-stripping announces itself
If something variable is not being stripped, the shape count explodes: thousands of shapes, almost all seen exactly once, and every hour brings hundreds of new ones. The digest becomes useless immediately and the cause is easy to find by looking at a handful of the one-off shapes and spotting what they have in common.
Common culprits are session identifiers that do not look like UUIDs, hostnames with a generated suffix, and durations formatted as text rather than numbers — “took 1.2 seconds” survives a numeric strip if the number is spelled differently each time.
Over-stripping is silent
The worse direction. If the strip is aggressive enough that “connection refused to the payment provider” and “connection refused to the mail provider” produce the same shape, then a brand-new payment outage is indistinguishable from the mail warning that happens twice a day, and it will never be reported.
The specific temptation is stripping quoted strings, which is usually right and occasionally catastrophic because the quoted string is the only thing distinguishing two errors. The compromise that works is stripping quoted values longer than a threshold and keeping short ones, since a short quoted string is usually a name and a long one is usually data.
Structured logs make this free
- Machine learning
- Security & identity
- Management
This is worth acting on where you can. If the logs are yours, adding an event field with a stable identifier makes the fingerprint a field lookup rather than a heuristic, and it removes the entire class of problem where somebody improves an error message and the system reports a new shape.
In practice most systems are mixed: your own functions log structured events and every library and runtime they use logs text. So the fingerprinter uses the event name when there is one and falls back to stripping when there is not, and the fallback is where all the care goes.
Next: what happens when a shape is new.
All posts