How to Analyse nginx and Apache Access Logs
Learn the Combined Log Format, filter access logs for errors, bots and slow requests, and turn raw nginx or Apache logs into answers you can act on.

How to Analyse nginx and Apache Access Logs
Every web server writes down what it does. Each request becomes a line with the visitor's address, the time, the method and path, the status code, the size of the response and often the browser and the referring page. Most of the time nobody reads these lines. When something goes wrong, they are often the fastest way to the answer. This guide explains the standard log formats and a practical way to question them, using the Log File Analyzer.
The Combined Log Format
Apache defines the Common Log Format and its extension, the Combined Log Format, and nginx uses the same layout by default. A typical line looks like this:
203.0.113.7 - - [02/Nov/2026:09:15:02 +0000] "GET /products HTTP/1.1" 200 5123 "https://example.com/" "Mozilla/5.0 ..."
The parts are the client IP, two placeholder fields for identity and user, the time with its offset from UTC, the request line, the status, the bytes sent, the referrer and the user agent. Many sites add the request time at the end, which turns access logs into a performance tool as well.
JSON logs
Modern stacks often write one JSON object per line, which is easier for machines to parse and lets you add fields such as a request ID or user ID. Field names vary between servers and shippers: time or @timestamp, status or status_code, remote_addr or client_ip. A flexible analyser recognises the common names and flattens nested objects.
Start with status codes
Status classes give a quick health check:
- 2xx: success.
- 3xx: redirects; a sudden spike can mean a misconfigured rule.
- 4xx: client errors; 404s show broken links or scanners, 401 and 403 show authentication issues, 429 shows rate limiting.
- 5xx: server errors; any steady stream of 500, 502, 503 or 504 needs attention.
Filter for 5xx first, then look at which paths and which times they cluster around.
Look at time
A timeline of requests per hour or minute shows peaks, outages and attacks. A sharp drop to zero suggests the server or a proxy stopped logging. A spike of errors at one moment usually lines up with a deploy, a database problem or a traffic surge. Compare the error line with the total line: a rising error count during a traffic peak is a capacity problem; rising errors with flat traffic is a bug.
Who is calling: IPs, user agents and bots
Group by IP to find heavy clients. One address requesting /wp-login.php hundreds of times on a site that is not WordPress is a scanner; block it at the firewall or rate limit it. User agents reveal search engine crawlers, monitoring services and scripts such as curl or python-requests. Separating bots from people gives you realistic numbers for real traffic, but remember that user agents can be faked.
Find broken links and heavy pages
Grouping 404s by path shows links that need redirects or fixes, often from old marketing campaigns or renamed pages. Grouping bytes by path shows which pages and assets cost the most bandwidth, a starting point for image compression or caching.
Use the response time
If your format includes $request_time, look at the median and the 95th percentile. The median tells you the typical experience; the 95th percentile shows the slow tail that frustrates users. Filter for one path to see whether a particular endpoint is responsible.
Privacy and retention
Access logs contain IP addresses, which are personal data in many jurisdictions. Keep them only as long as you need, restrict access, and prefer analysing them locally rather than uploading them to third-party services. When sharing excerpts in a ticket, remove or truncate IP addresses.
Limits
A browser tool is ideal for files up to tens of megabytes; very large logs belong in command-line tools or a log platform. Custom log formats that reorder fields may only be partly recognised, bot detection by user agent is approximate, and an analyser reads past events rather than monitoring and alerting in real time.



