From 43954854e64ff6a976d2387c38e76cc0e184a6a8 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 14 Oct 2015 13:28:06 +0200 Subject: Add more logs to the 'Real Time' tab and fix a typo in tag --- config/squid3/34/squid_monitor_data.php | 119 ++++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 7 deletions(-) (limited to 'config/squid3') diff --git a/config/squid3/34/squid_monitor_data.php b/config/squid3/34/squid_monitor_data.php index c2c3264d..747699cd 100755 --- a/config/squid3/34/squid_monitor_data.php +++ b/config/squid3/34/squid_monitor_data.php @@ -49,9 +49,6 @@ if ($_POST) { // Split line by space delimiter $logline = preg_split("/\s+/", $logent); - // Apply date format to first line - //$logline[0] = date("d.m.Y H:i:s",$logline[0]); - // Word wrap the URL $logline[7] = htmlentities($logline[7]); $logline[7] = html_autowrap($logline[7]); @@ -62,7 +59,7 @@ if ($_POST) { // Apply filter and color // Need validate special chars if ($filter != "") { - $logline = preg_replace("@($filter)@i","$1", $logline); + $logline = preg_replace("@($filter)@i","$1", $logline); } echo "\n"; @@ -75,6 +72,30 @@ if ($_POST) { echo "\n"; } break; + case 'squid_cache'; + // Define log file + $log = '/var/squid/logs/cache.log'; + // Show table headers + show_tds(array("Date-Time", "Message")); + // Fetch lines + $logarr = fetch_log($log); + foreach ($logarr as $logent) { + // Split line by delimiter + $logline = preg_split("@\|@", $logent); + + // Replace some build host nonsense and apply time format + $logline[0] = date("d.m.Y H:i:s", strtotime(str_replace("kid1", "", $logline[0]))); + + // Word wrap the message + $logline[1] = htmlentities($logline[1]); + $logline[1] = html_autowrap($logline[1]); + + echo "\n"; + echo "{$logline[0]}\n"; + echo "{$logline[1]}\n"; + echo "\n"; + } + break; case 'sguard'; $log = '/var/squidGuard/log/block.log'; // Show table headers @@ -107,7 +128,7 @@ if ($_POST) { echo "\n"; } break; - case 'clamav'; + case 'cicap_virus'; // Define log file $log = '/var/log/c-icap/virus.log'; // Show table headers @@ -115,7 +136,7 @@ if ($_POST) { // Fetch lines $logarr = fetch_log($log); foreach ($logarr as $logent) { - // Split line by space delimiter + // Split line by delimiter $logline = preg_split("/\|/", $logent); // Apply time format @@ -135,7 +156,91 @@ if ($_POST) { echo "\n"; } break; - } + case 'cicap_access'; + // Define log file + $log = '/var/log/c-icap/access.log'; + // Show table headers + show_tds(array("Date-Time", "Message")); + // Fetch lines + $logarr = fetch_log($log); + foreach ($logarr as $logent) { + // Split line by delimiter + $logline = preg_split("/,/", $logent); + + // Apply time format + $logline[0] = date("d.m.Y H:i:s", strtotime($logline[0])); + + // Word wrap the message + $logline[1] = htmlentities($logline[1]); + $logline[1] = html_autowrap($logline[1]); + + echo "\n"; + echo "{$logline[0]}\n"; + echo "{$logline[1]}\n"; + echo "\n"; + } + break; + case 'cicap_server'; + // Define log file + $log = '/var/log/c-icap/server.log'; + // Show table headers + show_tds(array("Date-Time", "Message")); + // Fetch lines + $logarr = fetch_log($log); + foreach ($logarr as $logent) { + // Split line by delimiter + $logline = preg_split("/,/", $logent); + + // Apply time format + $logline[0] = date("d.m.Y H:i:s", strtotime($logline[0])); + + // Word wrap the message + $logline[2] = htmlentities($logline[2]); + $logline[2] = html_autowrap($logline[2]); + + echo "\n"; + echo "{$logline[0]}\n"; + echo "{$logline[2]}\n"; + echo "\n"; + } + break; + case 'freshclam'; + // Define log file + $log = '/var/log/clamav/freshclam.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 "\n"; + echo "{$logline[0]}\n"; + echo "\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 "\n"; + echo "{$logline[0]}\n"; + echo "\n"; + } + break; + } } /* Functions */ -- cgit v1.2.3