function get_rps_and_rt_from_log($qps) { $file = get_log_files($qps); if (!isset($file)) { return array("null", "null"); } $no_rps = array(); $no_rt = array(); $i = 1; while ($i <= 10) { $log = exec("tac " . $file . " |sed -n " . $i . "p"); $temp = explode(' ', $log); $rps_temp = $temp[count($temp) - 4]; $rps = substr($rps_temp, 0, -1); $rt = $temp[count($temp) - 1]; $no_rps[$i] = $rps; $no_rt[$i] = $rt; $i = $i + 1; } asort($no_rps, SORT_NUMERIC); $pos_array = array_keys($no_rps); $pos = $pos_array[5]; return array($no_rps[$pos], $no_rt[$pos]); }
This is NOT a freeware, use is subject to license terms $Id: logs.inc.php 21053 2009-11-09 10:29:02Z wangjinbo $ */ if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } cpheader(); $lpp = empty($lpp) ? 20 : $lpp; $checklpp = array(); $checklpp[$lpp] = 'selected="selected"'; if (!in_array($operation, array('illegal', 'rate', 'credit', 'mods', 'medal', 'ban', 'cp', 'magic', 'error', 'invite', 'payment'))) { cpmsg('undefined_action', '', 'error'); } $logdir = DISCUZ_ROOT . './forumdata/logs/'; $logfiles = get_log_files($logdir, $operation . 'log'); $logs = array(); rsort($logfiles); if ($logfiles) { $logs = file(!empty($day) ? $logdir . $day . '_' . $operation . 'log.php' : $logdir . $logfiles[0]); } $page = max(1, intval($page)); $start = ($page - 1) * $lpp; $logs = array_reverse($logs); if (empty($keyword)) { $num = count($logs); $multipage = multi($num, $lpp, $page, "{$BASESCRIPT}?action=logs&operation={$operation}&lpp={$lpp}" . (!empty($day) ? '&day=' . $day : ''), 0, 3); $logs = array_slice($logs, $start, $lpp); } else { foreach ($logs as $key => $value) { if (strpos($value, $keyword) === FALSE) {
* [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: admincp_logs.php 29236 2012-03-30 05:34:47Z chenmengshu $ */ if (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) { exit('Access Denied'); } cpheader(); $lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp']; $checklpp = array(); $checklpp[$lpp] = 'selected="selected"'; $extrainput = ''; $operation = in_array($operation, array('illegal', 'rate', 'credit', 'mods', 'medal', 'ban', 'cp', 'magic', 'error', 'invite', 'payment', 'warn', 'crime', 'sendmail')) ? $operation : 'illegal'; $logdir = DISCUZ_ROOT . './data/log/'; $logfiles = get_log_files($logdir, $operation . ($operation == 'sendmail' ? '' : 'log')); $logs = array(); $lastkey = count($logfiles) - 1; $lastlog = $logfiles[$lastkey]; krsort($logfiles); if ($logfiles) { if (!isset($_GET['day']) || strexists($_GET['day'], '_')) { list($_GET['day'], $_GET['num']) = explode('_', $_GET['day']); $logs = file($_GET['day'] ? $logdir . $_GET['day'] . '_' . $operation . ($operation == 'sendmail' ? '' : 'log') . ($_GET['num'] ? '_' . $_GET['num'] : '') . '.php' : $logdir . $lastlog); } else { $logs = file($logdir . $_GET['day'] . '_' . $operation . ($operation == 'sendmail' ? '' : 'log') . '.php'); } } $start = ($page - 1) * $lpp; $logs = array_reverse($logs); if (empty($_GET['keyword']) && empty($_GET['filteract'])) {
* [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: modcp_log.php 25246 2011-11-02 03:34:53Z zhangguosheng $ */ if (!defined('IN_DISCUZ') || !defined('IN_MODCP')) { exit('Access Denied'); } if (!isset($_G['cache']['forums'])) { loadcache('forums'); } $language = lang('forum/misc'); $lpp = empty($_GET['lpp']) ? 20 : intval($_GET['lpp']); $lpp = min(200, max(5, $lpp)); $logdir = DISCUZ_ROOT . './data/log/'; $logfiles = get_log_files($logdir, 'modcp'); $logs = array(); foreach ($logfiles as $logfile) { $logs = array_merge($logs, file($logdir . $logfile)); } $page = max(1, intval($_G['page'])); $start = ($page - 1) * $lpp; $logs = array_reverse($logs); if (!empty($_GET['keyword'])) { foreach ($logs as $key => $value) { if (strpos($value, $_GET['keyword']) === FALSE) { unset($logs[$key]); } } } else { $_GET['keyword'] = '';
$logfile = $action; $logfiles = array(); foreach ($files as $file) { if (strpos($file, $logfile) !== FALSE) { $logfiles[] = $file; } } $logfiles = array_slice($logfiles, -2, 2); return $logfiles; } $lpp = empty($lpp) ? 50 : $lpp; if (!in_array($action, array('illegallog', 'ratelog', 'modslog', 'medalslog', 'banlog', 'cplog', 'errorlog', 'invitelog'))) { cpmsg('undefined_action'); } $logdir = DISCUZ_ROOT . './forumdata/logs/'; $logfiles = get_log_files($logdir, $action); $logs = array(); foreach ($logfiles as $logfile) { $logs = array_merge($logs, file($logdir . $logfile)); } $page = max(1, intval($page)); $start = ($page - 1) * $lpp; $logs = array_reverse($logs); if (empty($keyword)) { $num = count($logs); $multipage = multi($num, $lpp, $page, "admincp.php?action={$action}&lpp={$lpp}"); $logs = array_slice($logs, $start, $lpp); } else { foreach ($logs as $key => $value) { if (strpos($value, $keyword) === FALSE) { unset($logs[$key]);