diff options
author | doktornotor <notordoktor@gmail.com> | 2015-09-26 12:59:58 +0200 |
---|---|---|
committer | doktornotor <notordoktor@gmail.com> | 2015-09-26 12:59:58 +0200 |
commit | 2f12b1800d04b6f7ac456d5a76093d240cc4c34b (patch) | |
tree | daa0312e1a5ff9f0ae68124e4f1fff24bc99106e | |
parent | 8aeb36566343f0d2909e68a9876a879c0b49466c (diff) | |
download | pfsense-packages-2f12b1800d04b6f7ac456d5a76093d240cc4c34b.tar.gz pfsense-packages-2f12b1800d04b6f7ac456d5a76093d240cc4c34b.tar.bz2 pfsense-packages-2f12b1800d04b6f7ac456d5a76093d240cc4c34b.zip |
Provide real reason(s) in log when cache is cleared
-rw-r--r-- | config/squid3/34/swapstate_check.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/config/squid3/34/swapstate_check.php b/config/squid3/34/swapstate_check.php index ea9600f3..8b4c46bb 100644 --- a/config/squid3/34/swapstate_check.php +++ b/config/squid3/34/swapstate_check.php @@ -47,12 +47,28 @@ if (isset($settings['harddisk_cache_system']) && $settings['harddisk_cache_syste $diskusedpct = round((($disktotal - $diskfree) / $disktotal) * 100); $swapstate_size = filesize($swapstate); $swapstate_pct = round(($swapstate_size / $disktotal) * 100); - // If the swap.state file is taking up more than 75% disk space, + // If the swap.state file is taking up more than 75% of disk space, // or the drive is 90% full and swap.state is larger than 1GB, // kill it and initiate a rotate to write a fresh copy. + $rotate_reason = ""; + if ($swapstate_pct > 75) { + $rotate_reason .= "$cachedir/swap.state file is taking up more than 75% of disk space. "; + } + if ($diskusedpct > 90) { + $rotate_reason .= "$cachedir filesystem is $diskusedpct pct full. "; + } + if ($swapstate_size > 1024*1024*1024) { + $rotate_reason .= "$cachedir/swap.state is larger than 1GB. "; + } + if ($settings['clear_cache'] == 'on') { + $rotate_reason .= "'Clear Cache on Log Rotate' is enabled in 'Local Cache' settings. "; + } + if ($argv[1] == "clean") { + $rotate_reason .= "Clear cache forced by cronjob. "; + } if (($swapstate_pct > 75) || (($diskusedpct > 90) && ($swapstate_size > 1024*1024*1024)) || $argv[1] == "clean") { squid_dash_z('clean'); - log_error(gettext(sprintf("Squid cache and/or swap.state exceeded size limits. Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct))); + log_error(gettext(sprintf("$rotate_reason Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct))); } } ?> |