$logline = preg_replace("@({$filter})@i", "<spam><font color='red'>\$1</font></span>", $logline); } echo "<tr>\n"; echo "<td class=\"listlr\" nowrap>{$logline[0]} {$logline[1]}</td>\n"; echo "<td class=\"listr\">{$logline[3]}</td>\n"; echo "<td class=\"listr\" width=\"*\">{$logline[4]}</td>\n"; echo "<td class=\"listr\">{$logline[5]}</td>\n"; echo "<td class=\"listr\">{$logline[6]}</td>\n"; echo "</tr>\n"; } break; case 'clamav': // Define log file $log = '/var/log/c-icap/virus.log'; //show table headers show_tds(array("Date-Time", "Message", "Virus", "URL", "Host", "User")); //fetch lines $logarr = fetch_log($log); foreach ($logarr as $logent) { // Split line by space delimiter $logline = preg_split("/\\|/", $logent); // Apply time format $logline[0] = date("d.m.Y H:i:s", strtotime($logline[0])); // Word wrap the URL $logline[3] = htmlentities($logline[3]); $logline[3] = html_autowrap($logline[3]); echo "<tr>\n"; echo "<td class=\"listlr\" nowrap>{$logline[0]}</td>\n"; echo "<td class=\"listr\" nowrap>{$logline[1]}</td>\n"; echo "<td class=\"listr\">{$logline[2]}</td>\n"; echo "<td class=\"listr\">{$logline[3]}</td>\n";
$logline = preg_replace("@({$filter})@i", "<spam><font color='red'>\$1</font></span>", $logline); } echo "<tr valign=\"top\">\n"; echo "<td class=\"listlr\" nowrap>{$logline[0]} {$logline[1]}</td>\n"; echo "<td class=\"listr\">{$logline[3]}</td>\n"; echo "<td class=\"listr\">{$logline[4]}</td>\n"; echo "<td class=\"listr\" width=\"*\">{$logline[7]}</td>\n"; echo "<td class=\"listr\">{$logline[8]}</td>\n"; echo "<td class=\"listr\">{$logline_dest[1]}</td>\n"; echo "</tr>\n"; } break; case 'sguard': $log = '/var/squidGuard/log/block.log'; //show table headers show_tds(array("Date-Time", "ACL", "Address", "Host", "User")); //fetch lines $logarr = fetch_log($log); foreach ($logarr as $logent) { // Split line by space delimiter $logline = preg_split("/\\s+/", $logent); // Apply time format $logline[0] = date("d.m.Y", strtotime($logline[0])); // Word wrap the URL $logline[4] = htmlentities($logline[4]); $logline[4] = html_autowrap($logline[4]); // Apply filter color // Need validate special chars if ($filter != "") { $logline = preg_replace("@({$filter})@i", "<spam><font color='red'>\$1</font></span>", $logline); }
$logarr = fetch_log($log); foreach ($logarr as $logent) { $logline = preg_split("/\n/", $logent); // Word wrap the message $logline[0] = htmlentities($logline[0]); $logline[0] = html_autowrap($logline[0]); echo "<tr>\n"; echo "<td class=\"listlr\" nowrap=\"nowrap\">{$logline[0]}</td>\n"; echo "</tr>\n"; } break; case 'clamd': // Define log file $log = '/var/log/clamav/clamd.log'; // Show table headers show_tds(array("Message")); // Fetch lines $logarr = fetch_log($log); foreach ($logarr as $logent) { $logline = preg_split("/\n/", $logent); // Word wrap the message $logline[0] = htmlentities($logline[0]); $logline[0] = html_autowrap($logline[0]); echo "<tr>\n"; echo "<td class=\"listlr\" nowrap=\"nowrap\">{$logline[0]}</td>\n"; echo "</tr>\n"; } break; } } /* Functions */
} $agent_info = "onmouseover=\"jQuery('#browserinfo').empty().html('{$line[13]}');\"\n"; echo "<tr valign=\"top\" {$agent_info}>\n"; echo "<td class=\"listlr\" align=\"center\" nowrap>{$line[5]}({$line[6]})</td>\n"; echo "<td class=\"listr\" align=\"center\">{$line[1]}</td>\n"; echo "<td class=\"listr\" align=\"center\">{$line[10]}</td>\n"; echo "<td class=\"listr\" align=\"center\">{$line[7]}</td>\n"; //echo "<td class=\"listr\" width=\"*\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$line[13]}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 87, 'styleClass', 'niceTitle');\">{$line[8]}</td>\n"; echo "<td class=\"listr\" width=\"*\">{$line[8]}</td>\n"; echo "</tr>\n"; } } break; case 'error': //show table headers show_tds(array("DateTime", "Severity", "Message")); //fetch lines $logarr = fetch_log($logfile); // Print lines foreach ($logarr as $logent) { // Split line by space delimiter $logline = preg_split("/\n/", $logent); /* field 1: Wed Jul 04 20:22:28 2012 field 2: error field 3: 187.10.53.87 field 4: proxy: DNS lookup failure for: 192.168.15.272 returned by / */ $regex = '/^\\[([^\\]]+)\\] \\[([^\\]]+)\\] (?:\\[client ([^\\]]+)\\])?\\s*(.*)$/i'; if (preg_match($regex, $logline[0], $line)) { // Apply filter and color