cleaning log files before analysis

A practical TinyDevTools guide.

Start with an untouched copy

Keep the original log. Cleanup should produce a derived working copy so you can return to the source when a pattern needs verification.

A practical sequence

  1. Remove irrelevant blank lines if they add no diagnostic value.
  2. Trim accidental outer whitespace when it is known to be formatting noise.
  3. Find duplicates before removing them; repetition may itself be evidence.
  4. Remove duplicates only when repeated identical lines are known to be redundant.
  5. Sort only when chronology is no longer important and grouping helps analysis.

Preserve meaning

Logs are evidence. A transformation that makes them prettier can also make them less useful. Do not sort a chronological log merely to make repeated messages easier to see.

Find duplicates without changing the source →