Raw access logs are the first place you look when diagnosing unusual traffic, investigating abuse complaints, or troubleshooting a client's hosting performance. Every HTTP request hitting an Apache or LiteSpeed server gets written to these logs, and cPanel organizes them by domain. If you can read and interpret them fluently, you can answer questions like "Why is this account over bandwidth?", "Is this site under attack?", or "Which bot is hammering the login page?" in minutes instead of hours.
This guide walks you through locating cPanel raw access logs, understanding the log format, parsing key fields, and applying practical analysis techniques to solve real support cases.
Where cPanel Stores Raw Access Logs
cPanel keeps raw access logs in predictable locations. For individual domains, the log path follows this pattern:
/home/username/access-logs/domain.com
The username is the cPanel account name, and domain.com is the primary domain or addon domain. Subdomains and parked domains may have their own logs or share the primary domain's log depending on your Apache VirtualHost configuration.
If the account has multiple domains, each will have its own log file. For example:
/home/john/access-logs/example.com
/home/john/access-logs/shop.example.com
/home/john/access-logs/blog.example.net
These logs are plain text and rotate automatically. cPanel compresses older logs with gzip and appends a datestamp, so you'll also see files like domain.com-Jun-2026.gz.
To list all access logs for an account:
ls -lh /home/username/access-logs/
If you need to examine compressed logs, use zcat or zgrep instead of cat or grep.
Understanding the Apache Combined Log Format
Most cPanel servers log requests in the Combined Log Format, which Apache defines as:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
A typical line looks like this:
203.0.113.45 - - [21/Jun/2026:02:15:33 +0000] "GET /wp-login.php HTTP/1.1" 200 1245 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
Here's what each field means:
| Field | Example | Description |
|---|---|---|
| Remote IP | 203.0.113.45 |
The client's IP address (or proxy IP if behind CDN) |
| Identity | - |
RFC 1413 identity (almost always -) |
| User | - |
HTTP authenticated username (or - if none) |
| Timestamp | [21/Jun/2026:02:15:33 +0000] |
Request time in day/month/year:hour:minute:second timezone |
| Request line | "GET /wp-login.php HTTP/1.1" |
HTTP method, path, and protocol |
| Status code | 200 |
HTTP response status (200, 404, 500, etc.) |
| Bytes sent | 1245 |
Size of response in bytes (or - if zero) |
| Referer | "-" |
The page that linked to this request (or - if direct) |
| User-Agent | "Mozilla/5.0..." |
Browser or bot identifier |
Knowing these fields lets you extract exactly what you need. The request line is particularly important because it contains the HTTP method, the requested path (including query strings), and the protocol version.
Reading a Log Entry: A Real Example
Let's dissect a more complex line:
198.51.100.77 - - [21/Jun/2026:03:42:19 +0000] "POST /xmlrpc.php HTTP/1.0" 403 512 "https://evil.example/" "python-requests/2.28.0"
What this tells you:
- IP:
198.51.100.77made the request - Time: June 21, 2026 at 03:42:19 UTC
- Request:
POSTto/xmlrpc.phpusing HTTP/1.0 - Status:
403 Forbidden(blocked) - Size: 512 bytes returned
- Referer:
https://evil.example/(suspicious; likely spoofed) - User-Agent:
python-requests/2.28.0(a Python HTTP library, not a browser)
Interpretation: This is a scripted attack attempt against WordPress XML-RPC. The 403 status means something blocked it—likely a firewall rule, security plugin, or mod_security. The non-browser User-Agent and suspicious referer confirm automation.
Common Analysis Tasks
1. Find the Most Active IPs
When an account is over bandwidth or a site is slow, you need to know which IPs are hitting it hardest.
awk '{print $1}' /home/username/access-logs/domain.com | sort | uniq -c | sort -rn | head -20
This extracts the first field (IP address), counts occurrences, and sorts numerically in reverse order. The output looks like:
4523 203.0.113.45
2891 198.51.100.12
876 192.0.2.99
If one IP dominates, check if it's a legitimate bot (Googlebot, your monitoring service) or abusive traffic. Cross-reference the IP with the User-Agent and requested paths.
2. Identify Requests by Status Code
To see all 404 errors:
grep ' 404 ' /home/username/access-logs/domain.com | awk '{print $7}' | sort | uniq -c | sort -rn | head -20
Field $7 is the requested path. This shows which missing files or broken links are generating errors. If you see thousands of requests for /old-plugin/readme.txt or /.env, those are scanners probing for vulnerabilities.
For server errors (5xx):
grep ' 50[0-9] ' /home/username/access-logs/domain.com
3. Filter Requests by Time Range
If a client reports an outage between 14:00 and 15:00 UTC, isolate that window:
awk '$4 >= "[21/Jun/2026:14:00:00" && $4 <= "[21/Jun/2026:15:00:00"' /home/username/access-logs/domain.com
Adjust the date and time format to match your log's timestamp.
4. Analyze User-Agents
To see which bots or browsers are accessing the site:
awk -F'"' '{print $6}' /home/username/access-logs/domain.com | sort | uniq -c | sort -rn | head -20
The -F'"' sets the delimiter to double-quote, and $6 is the User-Agent field.
Watch for:
- Aggressive crawlers that ignore
robots.txt - Fake User-Agents like
Mozilla/5.0with no additional detail - Vulnerability scanners (
Nmap,Nikto,sqlmap) - Scrapers and scrapers disguised as browsers
5. Track Bandwidth by Path
To see which files or endpoints consume the most bandwidth:
awk '{url=$7; bytes=$10; sum[url]+=bytes} END {for (u in sum) print sum[u], u}' /home/username/access-logs/domain.com | sort -rn | head -20
This sums bytes sent for each unique path. Large video files, downloadable archives, or image galleries often top this list. If you see unexpected paths consuming gigabytes, investigate further.
Recognizing Common Attack Patterns
Brute Force Login Attempts
WordPress, Joomla, and cPanel login pages are frequent targets. Look for repeated POST requests to login endpoints:
grep 'POST /wp-login.php' /home/username/access-logs/domain.com | awk '{print $1}' | sort | uniq -c | sort -rn
If you see hundreds or thousands of requests from a single IP or distributed across many IPs, that's a brute force attack. Check the HTTP status codes—200 may indicate successful logins, while 302 or 401 usually mean failed attempts.
SQL Injection and Path Traversal Probes
Scanners test for vulnerabilities by appending payloads to URLs:
grep -E '(union.*select|concat\(|\.\./)' /home/username/access-logs/domain.com
This searches for common SQL injection keywords and directory traversal patterns. Most return 400 or 404, but log the IPs and consider blocking them at the firewall.
DDoS or Resource Exhaustion
A sudden spike in requests, especially to a single endpoint, might indicate a denial-of-service attempt:
awk '{print $4}' /home/username/access-logs/domain.com | cut -d: -f1-3 | uniq -c
This groups requests by hour. A normal site might show steady traffic; a DDoS shows sharp, abnormal spikes.
Working with Compressed and Archived Logs
cPanel archives older logs with gzip. To search across multiple months without decompressing:
zgrep '203.0.113.45' /home/username/access-logs/domain.com-*.gz
To count requests across all archived logs:
zcat /home/username/access-logs/domain.com-*.gz | wc -l
Combine current and archived logs for complete analysis:
cat /home/username/access-logs/domain.com <(zcat /home/username/access-logs/domain.com-*.gz) | grep '203.0.113.45'
Integrating with Other Tools
GoAccess for Visual Reports
GoAccess is a real-time web log analyzer that generates HTML, JSON, or terminal dashboards:
goaccess /home/username/access-logs/domain.com -o report.html --log-format=COMBINED
Open report.html in a browser to see visitor stats, top requests, bandwidth usage, operating systems, and more.
AWStats or Webalizer
cPanel includes AWStats and Webalizer by default. They process logs automatically and present monthly summaries via the cPanel interface under Metrics > AWStats or Metrics > Webalizer. These are useful for clients but less flexible than command-line analysis.
Custom Scripts
For recurring analysis tasks, write a bash or Python script. Here's a minimal Python example to count requests per IP:
import sys
from collections import Counter
ips = Counter()
for line in sys.stdin:
ip = line.split()[0]
ips[ip] += 1
for ip, count in ips.most_common(20):
print(f"{count:6} {ip}")
Use it like:
cat /home/username/access-logs/domain.com | python3 count_ips.py
Limitations and Gotchas
CDN and Proxy Headers
If the site uses Cloudflare, a CDN, or a reverse proxy, the remote IP field shows the proxy's IP, not the visitor's real IP. Cloudflare passes the real IP in the CF-Connecting-IP or X-Forwarded-For headers, but those don't appear in standard access logs by default.
To log real IPs with Cloudflare, you need to install mod_cloudflare or configure Apache to log X-Forwarded-For. Check the server's Apache configuration.
Log Rotation Gaps
Logs rotate at specific intervals (daily or when they reach a size threshold). If a log file is missing or a rotation failed, you may have gaps in your data.
Timestamp Zones
Log timestamps reflect the server's timezone unless the log format specifies otherwise. If you're correlating logs with events reported in a different timezone, convert carefully.
Privacy and Compliance
Access logs contain IP addresses, which are personal data under GDPR and similar regulations. Retain logs only as long as necessary, secure them appropriately, and avoid sharing them without redacting sensitive details.
Practical Checklist for Log Analysis
- [ ] Locate the correct log file in
/home/username/access-logs/ - [ ] Verify the log format (Combined is most common)
- [ ] Identify the time window relevant to the issue
- [ ] Extract and count top IPs, paths, or User-Agents
- [ ] Cross-reference suspicious IPs with abuse databases or
whois - [ ] Check HTTP status codes for errors or successful exploits
- [ ] Review bandwidth consumption by path or IP
- [ ] Look for known attack patterns (brute force, scanning, SQL injection)
- [ ] Correlate log data with server metrics (CPU, memory, load)
- [ ] Document findings and recommend mitigation (firewall rules, rate limiting, software updates)
Conclusion
Raw access logs are the most direct, unfiltered view of what's happening on a web server. For hosting support engineers, fluency in reading and parsing these logs turns vague complaints into concrete diagnoses. Whether you're tracking down a bandwidth spike, blocking an attacker, or proving a site was accessible during a reported outage, the access log holds the answers.
Start with simple commands like grep and awk, build up to custom scripts and visualization tools, and always cross-reference your findings with other logs and server metrics. The more comfortable you become with raw logs, the faster you'll resolve tickets and the more credible your explanations will be.
