cPanel produces dozens of logs across /usr/local/cpanel/logs, /var/log, /etc/apache2/logs, and per-user ~/access-logs. Not all of them matter for audit. Treating them all equally either fills disks with noise or misses the events that auditors and incident responders actually need.
The trade-off
Logs cost storage and central-logging bandwidth. Retention windows that are too short fail compliance audits and limit incident investigation. Retention that’s too long burns budget and complicates breach-notification scope (more retained data = more potential exposure).
How to decide — log taxonomy
Three tiers:
Tier 1 — keep at least 1 year (audit-critical):
/usr/local/cpanel/logs/access_log— WHM/cPanel UI and API access/usr/local/cpanel/logs/login_log— authentication events/var/log/secure— SSH authentication/var/log/maillog(or/var/log/exim_mainlog) — mail flow, including auth events- Database query log (if enabled for compliance)
/var/log/audit/audit.log(auditd) — kernel-level audit events- Backup product audit logs (JetBackup, R1Soft, Acronis)
Tier 2 — keep 30–90 days (operational):
- Apache/LiteSpeed access logs (
/etc/apache2/logs/access_log, per-account~/access-logs/*) - PHP-FPM and PHP error logs
- ModSecurity audit log
- ConfigServer Security & Firewall (CSF) logs
- Backup operation logs (success/failure)
Tier 3 — keep 7–14 days (debug):
- Apache error logs (high volume, mostly noise)
- DNS resolution logs
- MySQL slow query log (rotate frequently; archive selected entries)
What to do
- Configure log rotation explicitly per tier. Tier 1 logs should ship to a central, append-only store before local rotation deletes them. Tier 2 should rotate locally with appropriate retention.
- Ship Tier 1 logs to a central system (Loki, Elasticsearch, S3-with-Object-Lock, append-only Borg, etc.). The destination must survive a compromise of the cPanel host.
- Set rsyslog/syslog-ng to ship in near-real-time, not nightly batch. Compromised hosts can’t always exfiltrate later.
- Encrypt log shipping in transit. Encrypt the destination at rest.
- Test that logs are queryable when you need them. Untested log destinations frequently turn out to be unreadable during incidents.
- Document the retention policy. Auditors will ask “how long do you keep X” — the answer needs to be in a document, not in someone’s memory.
For the Quebec/multi-regime retention specifics, see the audit log retention configuration guide. Stack Harbor sets up tiered log retention and central shipping as part of managed cPanel operations.