
Most cPanel incidents leave fingerprints in logs long before a client opens a ticket. This cPanel log monitoring tutorial shows a practical workflow you can repeat in WHM. You’ll catch three issues early: brute-force logins, outbound spam bursts, and a rising tide of 500 errors.
You’ll start with what’s already on the server: WHM log views, Exim tools, and a few shell commands.
Then you’ll add lightweight daily summaries.
You’re not trying to “watch everything.” You’re trying to spot the few patterns that predict downtime, account compromise, or mail blacklisting.
What you’ll set up (and what you need)
- Who this is for: VPS/dedicated admins, resellers managing multiple cPanel accounts, or site owners with WHM access.
- Server assumptions: cPanel & WHM on AlmaLinux/Rocky/CloudLinux-class host, root WHM access, SSH access.
- Time: ~60–90 minutes to implement, then 10 minutes/week to maintain.
- Outcome: A “daily check” routine + basic alerting for authentication issues, mail anomalies, and web errors.
If you’re running cPanel on a hosting-grade VPS, leave headroom for logs, mail queues, and traffic spikes.
A managed VPS hosting plan from HostMyCode fits if you want someone else watching server health while you focus on customers.
Know where the important cPanel logs live
cPanel spreads useful signals across a few predictable paths. You don’t need to memorize every file.
You do need to know where to start when a symptom shows up.
- SSH authentication:
/var/log/secure(RHEL-family) or/var/log/auth.log(Debian-family) - cPanel/WHM interface logs:
/usr/local/cpanel/logs/access_log,/usr/local/cpanel/logs/error_log - Web server access/error: Apache typically
/etc/httpd/logs/(symlinks in/usr/local/apache/logs/); Nginx (if used) often/var/log/nginx/ - PHP errors: per-vhost or global error logs (varies), plus PHP-FPM pool logs if enabled
- Mail (Exim):
/var/log/exim_mainlog,/var/log/exim_rejectlog,/var/log/exim_paniclog - System messages:
/var/log/messagesorjournalctl
Tip: If disk usage already runs hot, fix that first.
Log monitoring fails in boring ways when /var fills up.
Keep this guide handy: VPS disk space troubleshooting.
Daily “5-minute” baseline checks in WHM
These checks catch most problems without any scripting. Do them daily for a week so you can learn what “normal” looks like.
After that, you’ll spot changes at a glance.
- WHM > Mail Queue Manager: look for unusual volume, repeated retries, or one domain/user dominating the queue.
- WHM > Email > Mail Delivery Reports: filter by domain and scan for repeated failures (auth, rate-limits, remote rejections).
- WHM > Metrics > Server Information + Service Status: confirm load, memory pressure, and whether Exim/Apache/PHP-FPM restarts repeat.
- WHM > System Health (if available): note any warnings about disk, RAM, or failed services.
This baseline saves time because it keeps you from chasing one-off spikes.
If you’re planning moves between servers, use a controlled cutover. It helps you avoid diagnosing self-inflicted outages: DNS cutover tutorial.
cPanel log monitoring tutorial: detect brute-force logins (SSH + cPanel + Webmail)
Password guessing usually shows up in waves. Attackers often try SSH first, then cPanel/webmail, then app-level logins (often WordPress).
Your goal is simple: spot the wave early and block it at the firewall layer before an account gets popped.
Step 1: Confirm where auth failures are coming from
On AlmaLinux/Rocky-based cPanel hosts, SSH failures usually land in /var/log/secure.
Run:
sudo grep -E "Failed password|Invalid user" /var/log/secure | tail -n 50
sudo awk '/Failed password|Invalid user/ {print $(NF-3)}' /var/log/secure \
| sed 's/port//' | sort | uniq -c | sort -nr | head
If one or two IPs dominate, this is likely a targeted brute-force attempt.
If you see a broad spread, it’s usually background bot noise.
Even “noise” is worth rate-limiting. It’s just less urgent.
Step 2: Check cPanel/WHM login pressure
cPanel UI access is recorded in:
sudo tail -n 50 /usr/local/cpanel/logs/access_log
sudo tail -n 50 /usr/local/cpanel/logs/error_log
Scan for repeated login attempts and bursts of 401/403 responses.
Also watch for spikes hitting /login/ or /cpsess paths.
Step 3: Turn the signal into an actionable block
If you use CSF/LFD (common on cPanel servers), tune the login-failure triggers and alerts.
You want to hear about a sustained attack before customers do.
- In WHM: Plugins > ConfigServer Security & Firewall (if installed).
- Verify LFD is enabled and email alerts go to an address you actually monitor.
If you don’t have CSF yet, use a WHM-safe setup that won’t break AutoSSL or mail delivery: cPanel firewall setup guide.
Then harden SSH so constant noise doesn’t turn into real risk.
Use keys, sensible auth settings, and a rollback plan.
Follow: SSH lockdown tutorial.
Spot outbound spam bursts before your IP reputation drops
On shared hosting-style VPS nodes, spam outbreaks rarely start as “millions of emails.”
They often start with one compromised mailbox sending a few hundred messages. Then bounces pile up.
The good news is that Exim logs usually make the culprit obvious.
Step 1: Find top senders in Exim quickly
These commands are safe and fast on most systems:
# Top authenticated senders (common for compromised mailbox passwords)
sudo awk -F"A=" '/A=dovecot_login/ {for(i=1;i<=NF;i++) if($i ~ /^A=/){print $i}}' /var/log/exim_mainlog \
| cut -d= -f2 | sort | uniq -c | sort -nr | head -n 20
# Top envelope-from domains (useful for spotting a single domain spike)
sudo awk -F"<=" '/<=/ {print $3}' /var/log/exim_mainlog \
| tr -d '<>' | awk -F@ 'NF==2 {print $2}' | sort | uniq -c | sort -nr | head
You’re looking for a sender that suddenly dominates the last hour or day of traffic.
Step 2: Correlate with rejections and bounces
# See why remote servers are rejecting you
sudo tail -n 80 /var/log/exim_rejectlog
# Bounce volume and reasons
sudo grep -E ">>|retry time not reached" /var/log/exim_mainlog | tail -n 80
A burst of spamhaus/policy/blocked rejections usually means your reputation is already sliding.
Step 3: Contain the sender without breaking the whole server
- Reset compromised mailbox passwords (and any accounts using the same password).
- Check mail clients for stored credentials. A “fixed” password often gets re-compromised by an infected endpoint.
- Limit sending rates per account/domain where appropriate.
If you want a more methodical workflow for mail incidents, keep these two guides bookmarked:
Catch rising 500 errors and slow pages using web logs (Apache/LiteSpeed)
Customers report “site down,” but the earlier signal is usually a spike in 500s/503s or PHP fatal errors.
Access logs help you see scope fast. You can quickly tell whether it’s one URL, one domain, or the entire node.
Step 1: Identify which vhost is throwing 500s
Start with your primary access log. Paths vary by stack, but on many cPanel Apache installs you can use:
sudo awk '$9 ~ /^5[0-9][0-9]$/ {print $1, $7, $9}' /usr/local/apache/logs/access_log \
| tail -n 50
To aggregate status codes and spot a trend:
sudo awk '{print $9}' /usr/local/apache/logs/access_log \
| sort | uniq -c | sort -nr | head
If 500-class codes jump suddenly, assume something changed.
Common triggers include a deploy, a plugin update, or a resource limit getting hit.
Step 2: Tie the failing requests to a domain and user
On cPanel, each account usually has logs under its home directory and/or in Apache domlogs.
Check:
/usr/local/apache/domlogs/(per-domain logs)/home/USERNAME/access-logs/(common on cPanel setups)
Example: top 500 URLs for a single domain log:
sudo awk '$9 ~ /^5/ {print $7}' /usr/local/apache/domlogs/example.com \
| sort | uniq -c | sort -nr | head -n 20
Step 3: Check PHP and resource-limit symptoms
If PHP-FPM is enabled in WHM, one noisy site can exhaust workers. That can push other sites into 502/504s.
If you haven’t tuned pools with per-site limits, do that next: PHP-FPM pool tuning.
Also check for OOM (out-of-memory) kills. They often show up as “random” 500s at first.
If the server has no swap, failures can get ugly fast.
Fixing swap safely is straightforward: VPS swap configuration.
Turn your checks into daily email summaries (Logwatch) without heavy tooling
Manual checks work on one server. They fall apart across several nodes.
A daily summary email covers a lot of ground with minimal setup.
Step 1: Install and enable Logwatch
On AlmaLinux/Rocky:
sudo dnf install -y logwatch
Basic configuration lives in /etc/logwatch/conf/logwatch.conf.
It may also live in /etc/logwatch/conf/ overrides, depending on the package.
Set:
- MailTo: your admin inbox
- Detail: Medium is usually enough
- Range: Yesterday (daily)
Then test-run:
sudo logwatch --detail Med --range yesterday --service all --mailto you@example.com
If you want a known-good walkthrough with sane defaults for hosting, follow: Logwatch setup tutorial.
Even though it’s written for Debian/Ubuntu, the workflow maps cleanly to RHEL-family cPanel servers.
Only package commands and log paths differ.
Step 2: Make sure logs rotate (or your monitoring will die)
One common failure mode is boring. Everything works until a log grows, disk fills, and services start failing.
Confirm logrotate runs and retains enough history for incident review.
If you need to adjust retention for busy access logs without disk spikes, use: Logrotate tutorial.
Practical checklists you can keep in your runbook
Brute-force checklist (10 minutes)
- Count SSH failures in
/var/log/secure; identify top IPs. - Scan
/usr/local/cpanel/logs/access_logfor repeated auth paths and 401/403 spikes. - Confirm CSF/LFD (or your firewall) is blocking repeat offenders.
- Verify WHM/cPanel 2FA is enabled for admins and resellers.
Outbound mail checklist (15 minutes)
- Check Mail Queue Manager for volume spikes and repeated retries.
- Extract top authenticated senders from
/var/log/exim_mainlog. - Review
/var/log/exim_rejectlogfor policy/blacklist errors. - Reset compromised mailbox passwords and enforce unique passwords.
500 error checklist (15 minutes)
- Aggregate status codes from Apache/LiteSpeed logs; confirm 5xx trend.
- Find the domain(s) with top 500 URLs via per-domain domlogs.
- Check PHP error logs and resource pressure (RAM, CPU, PHP-FPM workers).
- If a single account is noisy, enforce per-site limits (PHP-FPM pool tuning).
Common pitfalls that make monitoring noisy or useless
- Alerting without ownership: If nobody is responsible, alerts turn into wallpaper. Pick one inbox and one on-call rotation.
- No baseline: “100 failed logins” might be normal for your IP range. Measure for a week, then set expectations.
- Not testing restore paths: Logs help you detect issues. Backups help you recover. If you don’t test restores, you’re guessing.
- Ignoring time sync: If NTP is off, correlating incidents across logs becomes slow and error-prone.
Summary: build a small monitoring habit that prevents big incidents
This workflow keeps your attention on signals that matter for hosting: authentication pressure, mail reputation risk, and real application errors.
Start with WHM’s built-in views. Then add a daily log summary email.
Finally, tighten resource limits so one site can’t sink the node.
If you want this setup on a server with predictable performance and support for hosting operations, run it on a HostMyCode VPS. Step up to dedicated servers when you need isolation and consistent mail/web throughput.
If you manage cPanel for clients, the fastest win is a stable VPS plus a second set of eyes on server health and mail reputation signals. HostMyCode offers managed VPS hosting for hands-on operations, or you can start with a flexible HostMyCode VPS and apply the monitoring steps in this guide.
FAQ
How often should I review cPanel logs on a hosting VPS?
Daily is ideal for mail queue and auth noise, weekly for deeper web error trends.
If you’re seeing active abuse, check every few hours until it stabilizes.
Which log tells me who is sending spam on cPanel?
Start with /var/log/exim_mainlog and look for authenticated senders (often A=dovecot_login).
Then confirm patterns in WHM’s Mail Delivery Reports.
Why do I see 500 errors but the site “works for me”?
It’s often intermittent. A single URL may trigger a PHP fatal error, or requests may fail only under load.
Use per-domain domlogs to find the exact paths returning 500, then match timestamps to PHP logs.
Will Logwatch replace real monitoring?
No. It’s a low-cost daily summary.
Pair it with uptime checks and basic metrics if you manage production hosting. If you want a simple monitoring stack, see: VPS monitoring setup.
What’s the quickest way to reduce brute-force risk on WHM?
Use SSH keys, restrict access where possible, enable 2FA for WHM/cPanel, and run a firewall that auto-blocks repeated failures.
Then monitor logs so you notice new patterns quickly.