$logdate = $logdate2 = 0; if (file_exists($logfile)) { $logdate = filemtime($logfile); } if (file_exists($logfile2)) { $logdate2 = filemtime($logfile2); } $cachedate = $clusterfile->mtime(); if ($cachedate >= $logdate && $cachedate >= $logdate2) { $cachefound = true; $clusterfile->fetch(); } } if (!$cachefound) { $scale = 60; $scalenames = array(60 => 'minute', 60 * 60 => 'hour', 60 * 60 * 24 => 'day'); // *** Parse storage.log files *** $data = ezLogsGrapher::asum(ezLogsGrapher::parseLog($logfile, $scale), ezLogsGrapher::parseLog($logfile2, $scale)); ksort($data); // *** build graph and store it *** $graphname = sysInfoTools::ezpI18ntr('SysInfo', 'files per ' . $scalenames[$scale]); $graph = ezLogsGrapher::graph($data, $graphname, $scale); if ($graph != false) { $clusterfile->fileStoreContents($cachefile, $graph); } else { $errormsg = ezLogsGrapher::lastError(); } } // *** output *** $tpl->setVariable('graphsource', $cachefile); $tpl->setVariable('errormsg', $errormsg);
// nb: this dir is calculated the same way as ezlog does $debug = eZDebug::instance(); $logFiles = $debug->logFiles(); foreach ($logFiles as $level => $file) { $logfile = $file[0] . $file[1]; $logname = str_replace('.log', '', $file[1]); if (file_exists($logfile)) { $count = 1; $size = filesize($logfile); $modified = filemtime($logfile); // *** parse rotated log files, if found *** $data = array(); for ($i = eZdebug::maxLogrotateFiles(); $i > 0; $i--) { $archivelog = $logfile . ".{$i}"; if (file_exists($archivelog)) { $data = ezLogsGrapher::asum($data, ezLogsGrapher::parseLog($archivelog)); $size += filesize($archivelog); $count++; } } $logFilesList[$logname] = array('path' => $logfile, 'count' => $count, 'size' => $size, 'modified' => $modified, 'link' => 'sysinfo/logview/' . $logname); } } foreach (scandir('var/log') as $log) { $logfile = "var/log/{$log}"; if (is_file($logfile) && substr($log, -4) == '.log' && !in_array($log, array('error.log', 'warning.log', 'debug.log', 'notice.log', 'strict.log'))) { $logFilesList[$log] = array('path' => $logfile, 'count' => '[1]', 'size' => filesize($logfile), 'modified' => filemtime($logfile), 'link' => 'sysinfo/customlogview/' . str_replace(array('/', '\\'), ':', $logfile)); } } $logDir = eZSys::varDirectory() . '/' . $ini->variable('FileSettings', 'LogDir'); foreach (scandir($logDir) as $log) {