An error log looks overwhelming because it is mostly the same few problems repeated thousands of times. Collapse the repeats and almost every log turns out to contain a short list of distinct faults — usually three or four that account for nearly all the volume. Here is how to get to that list, and what the common entries actually mean.
Published 4 November 2026 · Qcramai Security
An access log records what was asked for. An error log records what your stack could not do about it — and unlike the access log, its format is not standardised. Apache, Nginx and PHP each write a different shape of line, and your application writes a fourth.
It is also the only log that routinely contains file paths, line numbers and stack frames. That makes it the most useful log for fixing a bug and the most dangerous one to leave readable, which is a theme that runs through the rest of this page.
One framing worth adopting: a 500 in your access log is a symptom;
the matching error log entry is the cause. Investigating a spike in server errors
without opening the error log is guessing.
This is the whole technique, and everything else follows from it. Ten thousand lines reading:
PHP Fatal error: Uncaught TypeError: foo(): Argument #1 must be
of type int, string given in /var/www/app/Order.php:184
are not ten thousand problems. They are one problem that happened ten thousand times. Grouping is what turns an unreadable file into a work queue.
To group, normalise away the parts that vary between occurrences and keep the parts that identify the fault:
88213 and order 88214 failing the same way is one signature.Then rank by count. The distribution is almost always severe: in most logs we look at, the top three signatures cover the large majority of lines. Fixing the first one is worth more than reading the remaining thousands.
Apache and Nginx share a severity scale: emerg, alert,
crit, error, warn, notice,
info, debug. PHP has its own: fatal errors, warnings, notices and
deprecations.
In practice:
emerg, alert, crit — rare
and always worth reading. If these appear, start here.error — where the real work is. Requests that
failed.warn — worth scanning for capacity signals
(worker_connections, upstream buffering) and otherwise easy to drown in.notice, info — startup messages,
graceful reloads, client disconnects. Mostly volume.Two deserve special mention. PHP deprecations are not urgent today and are
precisely what makes your next runtime upgrade painful, so they are worth clearing
deliberately rather than ignoring forever. And Nginx logs client disconnects at
info — a user closing a tab mid-request is not a fault, and
treating it as one is the most common false alarm we see.
upstream timed out (110: Connection timed out) —
your backend did not answer within proxy_read_timeout. The fault is almost
never Nginx. Raising the timeout hides it; find out why the backend is slow, usually with
the slow query log.connect() failed (111: Connection refused) — nothing
is listening. The backend is down, crashed, or bound to a different address or socket
than Nginx is configured to reach.no live upstreams while connecting to upstream —
every backend in the pool has been marked failed. Usually the end state of a cascade
rather than the start, so look earlier in the file for what began failing first.client intended to send too large body — an upload
exceeded client_max_body_size. A configuration mismatch, not an attack,
though it looks alarming.upstream sent too big header — usually a backend
setting an enormous cookie or a long redirect chain; raise
proxy_buffer_size only after confirming the header should be that
large.worker_connections are not enough — a genuine
capacity limit. Raise worker_connections, and check
worker_rlimit_nofile alongside it or you will hit a file-descriptor ceiling
instead.SSL_do_handshake() failed — often a client speaking
an obsolete protocol, or a scanner. High volume from scattered addresses is usually
background noise rather than a fault.server reached MaxRequestWorkers — every worker is
busy and requests are queueing. The capacity error. Before raising the limit, check
whether workers are blocked on something slow, because raising it on a memory-bound
server trades queueing for swapping.Premature end of script headers — the script died
before emitting a complete header block. Look for a fatal error or a crash at the same
timestamp.PHP Fatal error: Allowed memory size of N bytes exhausted
— almost always loading an unbounded result set into memory. Raising
memory_limit buys time; paginating or streaming fixes it.Maximum execution time exceeded — a long-running
request that belongs in a background job.Uncaught Exception ... in /path:line — the
highest-value entries in the file. The class, file and line are your signature, and the
trace tells you the path in.Error logs are where reliability and security meet, and there are four findings we report from them regularly:
display_errors is on in production, or your framework is in debug mode, every
error hands a visitor your absolute file paths, framework version, and sometimes database
credentials or connection strings. Log verbosely to disk; return a generic message to the
client. Always.500 spike from one source on one endpoint. Errors mean
input reached code that could not handle it — which is exactly what a probe does on
its way to finding something worse. Cross-reference the timestamps against your access
log.cat-ing them to a
terminal can execute escape sequences. Treat every field as hostile data on the way out as
well as the way in.
Rank by occurrences multiplied by blast radius, not by how alarming the wording is:
crit or above.Then re-run the grouping a week later. A log whose top signature has changed is a log that is being worked; one where it has not is a log nobody is reading.
debug in production?Not continuously. It is expensive in disk and I/O, it buries the entries that matter, and debug output is the most likely to contain sensitive values. Raise it deliberately to investigate something, then lower it again.
Startup and reload messages, cron and CLI invocations, background workers, and failures that occurred before the request was logged all appear in one and not the other. Nginx also logs TLS handshake failures that never became an HTTP request at all.
Long enough to correlate a fault with the release that introduced it — a few months is usually right. Rotate and compress, and remember that these files are more sensitive than access logs because of the paths and context they contain.
Not necessarily, but a log nobody can read is. The real cost of thousands of ignorable warnings is that a genuinely important entry arrives and nobody notices. Either fix them or filter them, rather than learning to scroll past.
Related reading:
reading access logs for the symptom side of
a 500, and
preventing remote code execution for the
controls behind several of the security findings above.