Reading logs without drowning in them
Thousands of log lines usually come down to a handful of real problems. How grouping repeated errors works, the grep tricks that get you most of the way, and how to keep secrets out of your logs.
AskMyServers team · · 3 min read

In this article
Open the error log on a busy server and it's a wall of text. Four thousand lines in the last hour. It looks like everything is on fire.
Usually it isn't. Most of those lines are the same three or four errors repeated over and over, with a different user ID, timestamp or request path each time. The trick is to see the groups, not the lines.
The poor man's version with grep
You can get surprisingly far with standard tools. Strip out the parts that change between lines (numbers, IDs, IP addresses), then count what's left:
grep -i error /var/log/myapp/app.log \
| sed -E 's/[0-9a-f]{8}-[0-9a-f-]{27}/<id>/g; s/[0-9]+/<n>/g' \
| sort | uniq -c | sort -rn | head -20That turns this:
Timeout after 30000ms for order 48213
Timeout after 30000ms for order 48217
Timeout after 30000ms for order 48230into this:
3 Timeout after <n>ms for order <n>Run it once and the shape of the problem usually becomes obvious: one error makes up 80% of the noise, and the interesting one that appeared twice is sitting further down the list.
What grouping gives you
Once errors are grouped (the usual name for the normalised version is a fingerprint), a few useful questions become easy:
- What's most common? Fix that first; it's probably affecting the most users.
- What's new? An error first seen 20 minutes ago, just after a deploy, deserves attention even if it's rare.
- What's related? In the example below, database connection failures and NGINX upstream timeouts at the same moment are almost certainly one problem, not two:
12 nginx upstream timed out (110) while reading response header
5 node Error: connect ECONNREFUSED 127.0.0.1:5432The app couldn't reach Postgres, so requests hung, so NGINX gave up. Fix the database connection and both go away.
Keep secrets out of your logs
Logs collect things they shouldn't: passwords in a failed login message, API keys in a URL, a full database connection string in a stack trace. Before you send logs anywhere, including a monitoring tool or an AI assistant, make sure they're cleaned up:
- Don't log request bodies or headers wholesale.
- Mask tokens and passwords in your logging library's configuration.
- Never log full connection strings.
AskMyServers also masks common secret patterns (passwords, bearer tokens, AWS and GitHub keys, database URLs) before storing anything, as a second line of defence. It's a safety net, not a replacement for not logging them in the first place.
Letting AI do the reading
Grouping turns thousands of lines into a short list. Explaining that list is a good job for an AI assistant: what the error means in plain English, what probably caused it, and what to try.
In the AskMyServers dashboard, Logs → Analyze with AI sends the top error groups (not your whole log) to Claude and comes back with a short list of issues, each with an explanation, a likely cause and a suggested fix. Logs are treated as data, never as instructions, so a malicious log line can't tell the assistant what to do.
Getting logs in
You can send logs from any shipper that can make an HTTPS request (Vector, Fluent Bit, or a small script) using an API key with the "ingest" scope. Each entry needs a message and, ideally, a source and severity. The Logs page shows a ready-to-copy example.