function DumpMemory() { if (!isset($GLOBALS["MEMORY"]["ACCESSES"])) { return; } if (tool_time_sec($GLOBALS["MEMORY"]["TIME"]) < 30) { return; } $GLOBALS["MEMORY"]["TIME"] = time(); $filename = "/home/apache/artica-stats/requests.log"; $c = 0; while (list($KEYMD5, $ARRAY) = each($GLOBALS["MEMORY"]["ACCESSES"])) { $RQS = $ARRAY["RQS"]; $CODE = $ARRAY["CODE"]; $IPADDR = $ARRAY["IPADDR"]; $SIZE = $ARRAY["SIZE"]; $TIME = $ARRAY["TIME"]; $HOSTNAME = $ARRAY["HOSTNAME"]; $LINE = "{$TIME};{$HOSTNAME};{$IPADDR};{$CODE};{$RQS};{$SIZE}"; $c++; writeCompresslogs($filename, $LINE); } $GLOBALS["MEMORY"]["ACCESSES"] = array(); $GLOBALS["MEMORY"]["TIME"] = time(); events("Writing {$c} events..."); @unlink("/etc/artica-postfix/apache-tail.time"); @file_put_contents("/etc/artica-postfix/apache-tail.time", time()); }
function CachedSizeMem($cached, $SIZE) { $line = time() . ";{$GLOBALS["REMOTE_PROXY_NAME"]};{$SIZE};"; writeCompresslogs("{$GLOBALS["LogFileDeamonLogDir"]}/MAIN_SIZE", $line); if ($cached == 0) { $line = time() . ";{$GLOBALS["REMOTE_PROXY_NAME"]};{$SIZE};"; writeCompresslogs("{$GLOBALS["LogFileDeamonLogDir"]}/NO_CACHED", $line); return; } $line = time() . ";{$GLOBALS["REMOTE_PROXY_NAME"]};{$SIZE};"; writeCompresslogs("{$GLOBALS["LogFileDeamonLogDir"]}/CACHED", $line); }