コード例 #1
0
ファイル: explain.php プロジェクト: akirsch/revive-adserver
                            fwrite($fpsla, $query . "\n");
                            fwrite($fpmqp, $query . "\n\n");
                        } else {
                            //$aResult[$k]['error']  = $result->getUserInfo();
                            $aResult[$k]['error'] = 'failed to explain statement: ' . $query;
                        }
                    }
                }
            }
        }
        fclose($fpsla);
        fclose($fpmqp);
        $aConf = $GLOBALS['_MAX']['CONF']['database'];
        $cmd = "sudo /usr/local/sbin/mysqlsla --user {$aConf['username']} --host {$aConf['host']} --port {$aConf['port']} --time-each-query --sort e --top 50 --flush-qc --avg 10 --raw mysqlsla.log > mysqlsla.txt";
        $fpsla = fopen(MAX_PATH . "/var/mysqlslarun", 'w');
        fwrite($fpsla, $cmd);
        fclose($fpsla);
        $cmd = "mysql-query-profiler --user {$aConf['username']} --host {$aConf['host']} --port {$aConf['port']} --database {$aConf['name']} mysqlqp.log > mysqlqp.txt";
        $fpmqp = fopen(MAX_PATH . "/var/mysqlqprun", 'w');
        fwrite($fpmqp, $cmd);
        fclose($fpmqp);
    }
    RV::enableErrorHandling();
    return $aResult;
}
if (array_key_exists('a', $_REQUEST)) {
    if ($_REQUEST['a'] == 'save') {
    }
}
$aDisplay = parseLogFile();
include 'templates/explain.html';
コード例 #2
0
ファイル: index.php プロジェクト: iszak/p1tma
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">

        <title>Log Statistics</title>
    </head>
    <body>

        <h1>Log Statistics</h1>

<?php 
$logs = findLogs('/home/itapps/lo/p1/tma/');
if ($logs) {
    foreach ($logs as $log) {
        $statistics = parseLogFile($log);
        // Error parsing file
        if (!$statistics) {
            $log = htmlentities($log);
            echo <<<HTML
                <p>File {$log} not readable</p>
HTML;
            continue;
        }
        $month = htmlentities($statistics['month']);
        echo <<<HTML
        <h2>{$month}</h2>
        <dl>
            <dt>Total requests</dt>
            <dd>{$statistics['totalRequests']}</dd>