Ahosting Logo
Knowledge Base

Where Server Logs Live and How to Read Them

Which log answers which questionAbout eight logs matter on a cPanel serverSite returns a server errorthe account error log names thefaultWho requested what, how oftenthe account access log holdsevery requestMail did or did not arrivethe Exim main log follows onemessage end to endLogin attempts and blocksthe authentication and cPHulklogsA panel action went wrongthe WHM and cPanel error logsBlocked part way throughthe ModSecurity audit logMost troubleshooting time is spent in the wrong file. Pick the log from the question, not from habit.

Most time spent troubleshooting a server is spent in the wrong file. There are not many logs that matter, and each answers a specific question.

The website's own logs

Per account, under the user's logs directory, and reachable from cPanel as well.

The error log is the first place to look when a site returns a 500 or a blank page. It names the file and the line, and it is very often the entire answer.

The access log records every request: address, time, path, status code, referrer. This is where you answer questions about traffic, which pages are producing 404s, whether a spike is real visitors or one crawler, whether something is hammering a login page.

Understanding cPanel error logs deals with reading them from the customer's side.

Mail

grep '[email protected]' /var/log/exim_mainlog | tail -50

Every message's outcome is here, incoming and outgoing. It distinguishes the two cases that look identical from outside: rejected by this server, or accepted and delivered but discarded at the far end.

Exim configuration and mail routing goes over what the entries mean.

Services that will not start

journalctl -u httpd --since "10 minutes ago"
journalctl -u exim -n 50

When a service fails to start, the reason is here in plain language; a port already in use, a configuration syntax error, a missing file. This is the log people skip, and it usually contains the answer already written out.

The panel itself

Under /usr/local/cpanel/logs/.

The access log records panel logins and actions with the username. That is the record for "who changed this", which matters on a server with more than one administrator or reseller.

The error log covers the panel's own failures, distinct from a site failing, and the right place when an interface itself misbehaves.

Certificates

AutoSSL keeps a log, readable from its screen in WHM. When a certificate did not renew, it states which domain was skipped and why.

The reason is almost always that the validation request could not be served; a domain not pointing at this server, or a redirect intercepting the check. Managing AutoSSL in WHM deals with the specifics.

Disk and rotation

Logs grow. On a busy server they grow quickly, and a partition filled by logs takes down every service that needs to write, which presents as a dozen unrelated faults at once.

du -sh /var/log/* | sort -h | tail -10

Rotation is configured and usually working. What it does not cover is a log that started growing unusually. A repeated error writing thousands of identical lines a minute. That is worth noticing as a problem in itself rather than as a disk issue.

The order to check

Start from the symptom rather than opening logs in sequence.

A site is broken → the account's error log. Mail did not arrive → the mail log. Something will not start → the journal. Somebody changed something → the panel access log.

And check the timestamp of whatever you find. The most common mistake in reading logs is finding a genuine error from last Tuesday and treating it as the cause of today's fault. Match the time to when the problem started, or you are debugging history.

Managing logs and log rotation on a VPS explains the same ground on a server without cPanel.

Read a log without drowning in it

The commands matter as much as knowing which file to open, because a busy log is thousands of lines an hour.

tail -f ~/logs/example.com | grep -v '\.css\|\.js\|\.png\|\.jpg'
grep -c ' 500 ' ~/logs/example.com
awk '$9>=500 {print $7}' ~/logs/example.com | sort | uniq -c | sort -rn | head
awk '{print $4}' ~/logs/example.com | cut -d: -f2 | sort | uniq -c

The first watches live traffic with the asset noise removed. The third lists which paths are producing server errors, which is usually the whole diagnosis. The fourth counts requests by hour, which shows immediately whether a problem correlates with load or with a schedule.

That last distinction decides where to look next: load points at capacity, a fixed hour points at a scheduled job. Telling whether a slow site is the server or the site sets out the follow-up.

Match the timestamps before believing anything

Logs from different sources use different formats and, more dangerously, sometimes different time zones.

A web server logging in local time and an application logging in UTC will appear to show a request and its error four hours apart, and any conclusion drawn from that ordering is wrong.

date; date -u
timedatectl | grep 'Time zone'

Confirm what each source is recording before correlating them, and prefer UTC everywhere on servers, which removes the problem entirely rather than requiring the arithmetic why a server clock matters covers.

When the log has already rotated away

Logs are compressed and eventually deleted, so the evidence for a problem noticed on Monday may be gone by the time anyone looks.

ls -la ~/logs/ /var/log/ | head -20
zgrep 'search-term' /var/log/exim_mainlog-*.gz

zgrep searches compressed archives without unpacking them, which is the command people do not know and need most often.

If an investigation is going to take days, copy the relevant logs somewhere safe immediately, rotation continues regardless of whether you are still using them. Managing logs and log rotation deals with adjusting the retention.

What is not in the logs at all

Three failures leave no server-side trace, and looking for them wastes the most time.

Browser errors. A JavaScript failure breaking a form produces nothing on the server: the request was never made.

Mail accepted and then filtered. The mail log records a successful delivery; what the receiving system did afterwards is outside it.

DNS problems. A visitor who could not resolve the name never reached the server, so a total outage caused by DNS looks like a quiet day in the access log.

Recognising these early is what stops an afternoon being spent grepping for something that was never written.