The support log contains a screenshot of an error; a minute later, the same address returned 200 again. For a rare 500-type error, that is not enough: random manual retries almost always happen during a healthy period. Build the investigation around one problematic request and trace it through the CDN, proxy, application, and dependencies.
Create a record for the problematic request
Confirm what response the client received. You need the exact URL, method, time and time zone, status, a fragment of the error page, duration, and request ID if it appears in a header. For a form or API, record the body type and size, a set of non-personal parameters, and the authentication state. Do not include passwords, cookies, tokens, or complete user data in the record.
Check the original response code. A CDN may show the user its own page and change 502 or 504 to a different status. The browser may display a cached document, while an analytics system may combine several classes of server errors. Save the diagnostic request in full:
curl -sS -D headers.txt -o response.html \
-w '%{http_code} %{time_total}\n' https://example.com/problem-urlA successful result only describes the current state. It does not disprove the recorded error. You can check the meaning of nearby codes in the HTTP status codes guide.
At this stage, the record looks like this:
UTC: 2026-08-14 07:31:42.618
URL/method: POST /api/report
external status: 500
request_id: 7f2…91c
release: unknown
node: unknown
safe condition: report_type=monthly, payload_size=1,8 МБThe unknown fields show what information is currently missing. Do not replace it with an assumption.
Reconstruct the timeline using request_id
Check the clocks and time zones on the edge, load balancer, application containers, database, and tracing system. Then take a short interval around the event. For a single error, a few minutes before and after is usually enough.
The best key is an end-to-end request_id or trace_id. If one is unavailable, combine the time, URL, method, host name, and duration. The client IP is less reliable: corporate NAT groups users together, mobile addresses change, and a CDN hides the original connection.
Record the sequence, one line per layer:
| Time | Layer | Event | Duration | Result |
|---|---|---|---|---|
| 07:31:42.618 | Edge | Accepted POST | 4,9 s | upstream error |
| 07:31:42.641 | Nginx | Forwarded to node-3 | 4,8 s | 500 |
| 07:31:42.650 | App node-3 | Started report | 4,7 s | exception |
| 07:31:47.301 | DB | Query completed | 4,5 s | pool timeout |
If the request appears in Nginx but not in the application, business logic is not yet the main area to investigate. If the application completed the request with 200, but the edge returned 500, investigate the segment after the application.
Compare with the nearest successful request
Find a response for the same route with similar parameters, before or after the error. Compare the application version, node, authentication method, experiment variant, region, input size, and cache state. A table of differences can rule out shared factors more quickly:
| Attribute | Error | Success |
|---|---|---|
| Version | 2026.08.14.3 | 2026.08.14.3 |
| Node | node-3 | node-1 |
| Report size | 1,8 MB | 1,7 MB |
| DB pool | wait of 4,5 s | wait of 40 ms |
Here, the version is the same, so the node and pool are worth checking. If 17 of 19 errors came from one container, the hypothesis can be tested. If the failure occurs on all nodes only when a field is empty, focus shifts to handling edge-case data.
Do not copy a production record in full into a test environment. Reproduce the minimum relevant properties using anonymized data: size, a missing field, number of items, or user role.
Check logs from the outside in
Read the edge or CDN logs, proxy access/error logs, application logs, database logs, queue logs, and external API logs in the order the request passes through them. At each layer, answer: did the request arrive, where was it forwarded, how long did processing take, and how did it end?
Searching only for the string 500 misses important events. The application may log the exception type without an HTTP code. A proxy may generate 500 after the process closes the connection. Container restarts, pool exhaustion, garbage collection pauses, file read errors, and external API limit breaches can all be useful clues.
A CPU graph around the time of the failure is a correlation until you establish a chain of events. A confirmation is specific: an increase in concurrent tasks used all available connections, the request waited for a pool longer than the limit, the handler timed out, and returned 500.
Pay particular attention to time limits. The client, CDN, proxy, and application may interrupt work at different points. A short external timeout can cut off the response while the application continues to consume resources; a timeout that is too long can hold up the queue during a degradation.
Prepare telemetry for the next occurrence
“Cannot reproduce now” means there was not enough observability. Add safe fields: an end-to-end identifier, release version, node name, structured exception type, stage durations, and dependency response code. Do not log password contents, authorization headers, or client form bodies.
Count 5xx errors by route, version, and node. The overall site-wide rate can hide a failure in a rarely used but critical API. For each alert, save a safe example request_id and a link to the relevant log time range. Combine repeated instances of the same cause into one event with a counter.
An external uptime monitor is useful only for errors that occur when it sends a GET request to the configured URL. Rare failures between checks, POST requests, other routes, and stack traces remain the responsibility of server metrics and logs.
Requirements for reliable external signals are described in more detail in the article on uptime monitoring.
Test one hypothesis at a time
State it with a condition and mechanism: “Version 3 on node-3 returns 500 for a report larger than 1,5 MB because the database connection takes more than four seconds to obtain.” This makes the test, the required logs, and the way to disprove the hypothesis clear.
Reproduce the combination of conditions in a test environment or on an agreed diagnostic route. Do not run a large-scale load test on a production site without a scheduled window. A targeted safe request, reading logs, and comparing nodes are acceptable.
The fix should change the observed mechanism: handle a missing field, limit concurrency, release a connection, correct the configuration on one node, or return an appropriate 4xx for an invalid request. Simply increasing the timeout may only delay the failure.
Before deployment, record the baseline frequency, the problematic condition, and the expected result. After deployment, test that condition against the new version and check related metrics: success rate, latency, queue, and number of retries.
Close the record with evidence
One quiet hour is not enough for a rare error. Choose the observation window based on the previous frequency: an event that happens once a week requires a longer check than dozens of errors per hour. The record should contain:
- a confirmed cause or an honest “insufficient data” status;
- affected routes, versions, and nodes;
- evidence linking the condition to the exception;
- the change and how it was tested;
- the observation period after deployment;
- a signal added in case the issue recurs.
Example final entry: Версия 2026.08.15.1 обработала 312 отчётов >1,5 МБ на всех трёх узлах; pool timeout и HTTP 500 не повторились за семь суток; алерт по ожиданию пула включён. If the cause remains unknown, list the telemetry fields added and the criteria for resuming the investigation.