Estimate application log directory growth rate and days until disk capacity is reached.
Assuming a roughly constant daily growth rate, a log file's size at any future day is simply its current size plus the daily growth multiplied by the number of days elapsed — a linear projection. Rearranging that same relationship to solve for time gives the number of days until the log reaches any chosen size threshold, whether that threshold represents a monitoring alert level or the physical capacity of the partition it lives on, which is useful for scheduling log rotation or cleanup before a threshold is breached rather than reacting after the fact.
Projected size at day n
size_at_day_n = initial_size + daily_rate × n
Days until threshold
days = (threshold − initial_size) / daily_rate
Real log volume often correlates with traffic or error rates, which vary by day of week, seasonal events, or incidents — a sudden bug causing repeated error logging can spike growth far above the historical average rate used in a linear projection, so treat this as a planning estimate rather than a guarantee.
Sample the file size with `stat -c%s /path/to/log` (or `du`) at the same time on consecutive days and take the difference, or average the difference over a week to smooth out day-to-day variance before feeding it into a growth projection.
Set up or tighten logrotate rules to cap growth before the threshold date, add monitoring alerts at an earlier checkpoint (e.g. 80% of the threshold) to catch acceleration in the growth rate, or route logs to centralized storage with its own retention policy.