Ejemplo n.º 1
0
function show_all($flags_)
{
    $logfiles = glob(SESSIONMANAGER_LOGS . '/*.log');
    $logfiles = array_reverse($logfiles);
    $display = array();
    foreach ($logfiles as $logfile) {
        $lines = get_lines_from_file($logfile, 20, $flags_);
        $display[basename($logfile)] = $lines;
    }
    $servers = Abstract_Server::load_all();
    $display2 = array();
    foreach ($servers as $server) {
        $buf = new Server_Logs($server);
        $buf->process();
        $lines = $buf->getLog(20);
        if ($lines !== false) {
            $display2[$server->getAttribute('fqdn')] = array();
        }
        if ($lines !== false) {
            $display2[$server->getAttribute('fqdn')]['web'] = get_lines_from_string($lines, 20, $flags_);
        }
    }
    page_header();
    echo '<h1>' . _('Logs') . '</h1>';
    echo '<div>';
    echo '<div class="section">';
    echo '<h1>' . _('Session Manager') . '</h1>';
    foreach ($display as $name => $lines) {
        echo '<h3>' . $name;
        echo ' <a href="?show=1&amp;where=sm&amp;name=' . $name . '"><img src="media/image/view.png" width="22" height="22" alt="view" onmouseover="showInfoBulle(\'' . _('View full log file online') . '\'); return false;" onmouseout="hideInfoBulle(); return false;" /></a>';
        echo ' <a href="?download=1&amp;where=sm&amp;name=' . $name . '"><img src="media/image/download.png" width="22" height="22" alt="download" onmouseover="showInfoBulle(\'' . _('Download full log file') . '\'); return false;" onmouseout="hideInfoBulle(); return false;" /></a>';
        echo '</h3>';
        echo '<div style="border: 1px solid #ccc; background: #fff; padding: 5px; text-align: left;" class="section">';
        echo implode("<br />\n", $lines);
        echo '</div>';
    }
    echo '</div>';
    echo '<div class="section">';
    echo '<h1>' . _('Slave Servers') . '</h1>';
    foreach ($display2 as $fqdn => $logs) {
        $server = Abstract_Server::load($fqdn);
        echo '<h2><img src="media/image/server-' . $server->stringType() . '.png" alt="' . $server->stringType() . '" title="' . $server->stringType() . '" /> <a href="servers.php?action=manage&amp;fqdn=' . $fqdn . '">' . $fqdn . '</a></h2>';
        echo '<div class="section">';
        echo '<h4>' . _('Log');
        echo ' <a href="?show=1&amp;where=aps&amp;server=' . $fqdn . '"><img src="media/image/view.png" width="22" height="22" alt="view" onmouseover="showInfoBulle(\'' . _('View full log file online') . '\'); return false;" onmouseout="hideInfoBulle(); return false;" /></a>';
        echo ' <a href="?download=1&amp;where=aps&amp;server=' . $fqdn . '"><img src="media/image/download.png" width="22" height="22" alt="download" onmouseover="showInfoBulle(\'' . _('Download full log file') . '\'); return false;" onmouseout="hideInfoBulle(); return false;" /></a>';
        echo '</h4>';
        echo '<div style="border: 1px solid #ccc; background: #fff; padding: 5px; text-align: left;" class="section">';
        echo implode("<br />\n", $logs['web']);
        echo '</div>';
        echo '</div>';
    }
    echo '</div>';
    echo '</div>';
    page_footer();
    die;
}
Ejemplo n.º 2
0
 public function log_preview()
 {
     $this->check_authorized('viewStatus');
     $logfiles = glob(SESSIONMANAGER_LOGS . '/*.log');
     $logfiles = array_reverse($logfiles);
     $ret = array();
     foreach ($logfiles as $logfile) {
         $obj = new FileTailer($logfile);
         $lines = $obj->tail(20);
         $ret[basename($logfile)] = $lines;
     }
     $servers = Abstract_Server::load_all();
     $ret['servers'] = array();
     foreach ($servers as $server) {
         $buf = new Server_Logs($server);
         $buf->process();
         $lines = $buf->getLog(20);
         if ($lines !== false) {
             $ret['servers'][$server->id] = explode("\n", $lines);
         }
     }
     return $ret;
 }