Web server logs filling hosting storage? Find the writer before changing rotation
A hosting dashboard says disk is nearly full, and web-server logs look large. That is a symptom, not yet a reason to delete files or turn logging off. Identify which account and log path are growing, how fast they grow, which process writes them, and whether the rotation policy actually covers that path. Then fix the cause and verify that the storage trend improves.
Boletolibre editorial team
Published
First prove that logs are the storage pressure
Record the host or account, the affected filesystem or plan quota, used and available bytes, and the reading time. A hosting plan's account meter may include archived logs alongside website files, mail and databases; it is not always the same as the server filesystem. In cPanel, Raw Access shows disk usage for current domain logs and separately lists archives kept in the account's home directory. Ask your provider which meter is alarming if the scope is unclear.[6]
Compare the largest measured log paths at two times, using the same unit and scope. Example: an active error log grows from 2.0 to 2.6 GB in three hours; that is about 0.2 GB per hour at that moment, not a forecast for the next month. Record whether the growth is in an active file, rotated archives or both. Do not infer the cause from a folder name alone.
Map each large log to its actual writer
List the exact path, log type, owning service and application or site. Apache can write access and error logs, and application handlers can send messages into Apache's error log. A server may also have separate logs for virtual hosts. NGINX has configurable access logging and a separate error log. A new plugin or application may create an additional file outside the path covered by the host's usual rotation rule.[1][3][4]
If a rotation file exists but space keeps shrinking, check whether its path pattern matches the file that is actually growing. Also look for copies written by an application, a debug-level setting left on after troubleshooting, and a log format that records unusually long entries. Sample only enough redacted lines to classify the repeated event; raw logs can contain addresses, query strings and other sensitive data.[1][7]
Separate a traffic burst from a repeated error
Compare log entries and request counts over the same interval. A large access log may reflect a real traffic surge, a repeated bot or health-check request, or a format with unusually verbose fields. A rapidly growing error log may reflect one repeated application or routing failure. Classify the dominant path, status or error family before suppressing anything; a single sample line is not proof of the whole cause.[1][3]
Preserve a short, redacted evidence sample and the times of the first and latest occurrences. Fix the source if possible: a broken asset referenced on every page, a retrying integration or an accidentally enabled debug mode can continue to generate logs even after one archive is removed. Keep enough logging to verify the remedy and investigate future incidents.[1][7]
| Observed growth | Next evidence to collect |
|---|---|
| One active error log grows quickly | Most frequent error signature and the change that preceded it |
| Access logs grow during a traffic spike | Request rate, dominant route and whether traffic is expected |
| Archive count grows but active log is modest | Retention policy, archive location and expiry owner |
| A log outside the rotation pattern grows | Writer, exact path and missing rotation coverage |
Check rotation coverage, schedule and reopen behavior
For every large file, compare the actual path with the configured rotation rule, the last successful rotation, the retained archive count and the next expected run. Logrotate supports time and size conditions, but a rule can exist without matching a newly created path. Its `size`, `minsize` and `maxsize` options behave differently, so read the rule and scheduler cadence: a size threshold is evaluated when logrotate runs, not continuously.[5]
After an external rotation moves a file, the web server must begin writing to the new one. Apache documents a graceful restart to reopen logs after external rotation; NGINX documents reopening its logs after rotation. If this handoff fails, the process may keep writing to an old file. Logrotate's `copytruncate` is an alternative for a process that cannot reopen, but its manual warns of a small window in which entries can be lost. Have the server owner choose the mechanism for the running stack.[1][2][5]
Agree on retention before reclaiming space
Distinguish an active log from archived copies. Determine whether archives support incident response, analytics, billing or another team's retention requirement. cPanel, for example, has separate controls for archiving raw access logs and retaining older archives; those settings are account-specific. Get the owner to approve a documented retention change before removing evidence, and keep required copies in the approved location.[6][7]
Avoid blanket deletion, disabling all logging or truncating an active file merely because the meter is high. Those actions can erase the very evidence needed to find recurring errors. On a managed host, send the provider the measured path, growth interval and service owner, and ask which rotation and retention controls are available for that plan. On a self-managed server, use the vendor's documented reopen process and keep a rollback for configuration changes.[1][2][7]
Copy the log-growth investigation worksheet
Download the editable worksheet
Use a separate worksheet for each path. Pair every proposed change with a verification measurement and a person who owns the retention decision. The same sheet works for a host support ticket or an internal incident review.
| Field | What to record |
|---|---|
| Meter and scope | Account or filesystem, used/available bytes, time and zone |
| Growing path | Exact log and archive paths; bytes at two times; interval |
| Writer and pattern | Web server/app, dominant request or error class, recent change |
| Rotation proof | Matching rule, last and next run, reopen mechanism, retained archives |
| Proposed remedy | Source fix, bounded rotation change, approved retention decision |
| Verification | Active log path receives entries, rotated archive stops growing, free-space trend stabilizes or improves, log growth falls |
Verify the cause is fixed, not just the current meter
After the approved change, confirm the website still serves ordinary pages and forms, that the expected current log receives new entries, and that the previous rotated file has stopped growing. Compare storage and log size at a second measured interval. If the same error signature continues, return to the application or routing cause rather than shortening retention again.[1][2]
Add a storage or quota alert and schedule a review of unmatched log paths after deployments. Keep the alert threshold and retention duration tied to your actual capacity, traffic and policy rather than a universal number. Record the owner, the next review date and the original growth rate so the next surge is visible before it interrupts the site.[7]
Sources and further reading
- Apache HTTP Server: Log Files and Log RotationApache Software Foundation · Accessed
- Controlling nginx: Rotating Log-filesNGINX · Accessed
- NGINX HTTP Log ModuleNGINX · Accessed
- NGINX core: error_log directiveNGINX · Accessed
- logrotate manuallogrotate project · Accessed
- Raw Access: Log Archives and Disk UsagecPanel & WHM · Accessed
- Logging Cheat SheetOWASP · Accessed