aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/squid-reverse/squid.xml20
-rw-r--r--config/squid-reverse/squid_auth.xml4
-rw-r--r--config/squid-reverse/squid_cache.xml4
-rwxr-xr-xconfig/squid-reverse/squid_log_parser.php57
-rw-r--r--config/squid-reverse/squid_monitor.php94
-rw-r--r--config/squid-reverse/squid_monitor_data.php252
-rw-r--r--config/squid-reverse/squid_nac.xml4
-rw-r--r--config/squid-reverse/squid_reverse.xml4
-rw-r--r--config/squid-reverse/squid_reverse_general.xml4
-rw-r--r--config/squid-reverse/squid_reverse_peer.xml4
-rwxr-xr-xconfig/squid-reverse/squid_reverse_sync.xml4
-rw-r--r--config/squid-reverse/squid_reverse_uri.xml4
-rwxr-xr-xconfig/squid-reverse/squid_sync.xml4
-rw-r--r--config/squid-reverse/squid_traffic.xml4
-rw-r--r--config/squid-reverse/squid_upstream.xml4
-rw-r--r--config/squid-reverse/squid_users.xml4
16 files changed, 304 insertions, 167 deletions
diff --git a/config/squid-reverse/squid.xml b/config/squid-reverse/squid.xml
index 2a7771b3..7ca2c1e9 100644
--- a/config/squid-reverse/squid.xml
+++ b/config/squid-reverse/squid.xml
@@ -99,6 +99,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
@@ -194,6 +198,22 @@
<chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/squid-reverse/swapstate_check.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/squid-reverse/squid_monitor.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/squid-reverse/squid_monitor_data.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/squid-reverse/squid_log_parser.php</item>
+ </additional_files_needed>
+
<fields>
<field>
<name>Squid General Settings</name>
diff --git a/config/squid-reverse/squid_auth.xml b/config/squid-reverse/squid_auth.xml
index 43cbe7ea..307669c5 100644
--- a/config/squid-reverse/squid_auth.xml
+++ b/config/squid-reverse/squid_auth.xml
@@ -80,6 +80,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_cache.xml b/config/squid-reverse/squid_cache.xml
index c00322cf..7f371f49 100644
--- a/config/squid-reverse/squid_cache.xml
+++ b/config/squid-reverse/squid_cache.xml
@@ -80,6 +80,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_log_parser.php b/config/squid-reverse/squid_log_parser.php
new file mode 100755
index 00000000..f6cd7de8
--- /dev/null
+++ b/config/squid-reverse/squid_log_parser.php
@@ -0,0 +1,57 @@
+#!/usr/local/bin/php -q
+<?php
+/* ========================================================================== */
+/*
+ squid_log_parser.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012 Carlos Cesario - carloscesario@gmail.com
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+
+# ------------------------------------------------------------------------------
+# Simple Squid Log parser to rewrite line with date/time human readable
+# Usage: cat /var/squid/log/access.log | parser_squid_log.php
+# ------------------------------------------------------------------------------
+
+$logline = fopen("php://stdin", "r");
+while(!feof($logline)) {
+ $line = fgets($logline);
+ $line = rtrim($line);
+ if ($line != "") {
+ $fields = explode(' ', $line);
+ // Apply date format
+ $fields[0] = date("d.m.Y H:i:s",$fields[0]);
+ foreach($fields as $field) {
+ // Write the Squid log line with date/time human readable
+ echo "{$field} ";
+ }
+ echo "\n";
+ }
+}
+fclose($logline);
+?> \ No newline at end of file
diff --git a/config/squid-reverse/squid_monitor.php b/config/squid-reverse/squid_monitor.php
index da293358..ccc44fb9 100644
--- a/config/squid-reverse/squid_monitor.php
+++ b/config/squid-reverse/squid_monitor.php
@@ -1,34 +1,34 @@
<?php
-/* $Id$ */
/* ========================================================================== */
/*
- squid_monitor.php
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2012 ccesario @ pfsense forum
- All rights reserved.
-
+ squid_monitor.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012 Carlos Cesario - carloscesario@gmail.com
+ All rights reserved.
+ */
/* ========================================================================== */
/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/* ========================================================================== */
@@ -74,8 +74,34 @@ include("head.inc");
}, 1)
}
</script>
-
-
+<div id="mainlevel">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+ <?php
+ $tab_array = array();
+ if ($_REQUEST["menu"]=="reverse"){
+ $tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=squid_reverse_general.xml&amp;id=0");
+ $tab_array[] = array(gettext("Web Servers"), false, "/pkg.php?xml=squid_reverse_peer.xml");
+ $tab_array[] = array(gettext("Mappings"), false, "/pkg.php?xml=squid_reverse_uri.xml");
+ $tab_array[] = array(gettext("Real time"), true, "/squid_monitor.php?menu=reverse");
+ $tab_array[] = array(gettext("Sync"), false, "/pkg_edit.php?xml=squid_reverse_sync.xml");
+ }
+ else{
+ $tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=squid.xml&amp;id=0");
+ $tab_array[] = array(gettext("Remote Cache"), false, "/pkg.php?xml=squid_upstream.xml");
+ $tab_array[] = array(gettext("Local Cache"), false, "/pkg_edit.php?xml=squid_cache.xml&amp;id=0");
+ $tab_array[] = array(gettext("ACLs"), false, "/pkg_edit.php?xml=squid_nac.xml&amp;id=0");
+ $tab_array[] = array(gettext("Traffic Mgmt"), false, "/pkg_edit.php?xml=squid_traffic.xml&amp;id=0");
+ $tab_array[] = array(gettext("Authentication"), false, "/pkg_edit.php?xml=squid_auth.xml&amp;id=0");
+ $tab_array[] = array(gettext("Users"), false, "/pkg.php?xml=squid_users.xml");
+ $tab_array[] = array(gettext("Real time"), true, "/squid_monitor.php");
+ $tab_array[] = array(gettext("Sync"), false, "/pkg_edit.php?xml=squid_sync.xml");
+ }
+ display_top_tabs($tab_array);
+ ?>
+</td></tr>
+ <tr>
+ <td>
<div id="mainarea" style="padding-top: 0px; padding-bottom: 0px; ">
<form id="paramsForm" name="paramsForm" method="post">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
@@ -103,7 +129,9 @@ include("head.inc");
<input name="strfilter" type="text" class="formfld search" id="strfilter" size="50" value="">
<br/>
<span class="vexpl">
- Enter the string filter: eg. username or ip addr or url.
+ Enter a grep like string/pattern to filterlog.<br>
+ eg. username, ip addr, url.<br>
+ Use <b>!</b> to invert the sense of matching, to select non-matching lines.
</span>
</td>
</tr>
@@ -131,7 +159,7 @@ include("head.inc");
</tr>
</tbody>
</table>
-
+<?php if ($_REQUEST["menu"]!="reverse"){?>
<!-- SquidGuard Table -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
@@ -153,6 +181,12 @@ include("head.inc");
</tbody>
</table>
</div>
+<?php }?>
+</td>
+</tr>
+</table>
+</div>
+
<?php
include("fend.inc");
diff --git a/config/squid-reverse/squid_monitor_data.php b/config/squid-reverse/squid_monitor_data.php
index 12d2a34a..fcd5d178 100644
--- a/config/squid-reverse/squid_monitor_data.php
+++ b/config/squid-reverse/squid_monitor_data.php
@@ -1,37 +1,36 @@
-<?php
-/* $Id$ */
+<?php
/* ========================================================================== */
/*
- squid_monitor.php
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2012 ccesario @ pfsense forum
- All rights reserved.
-
+ squid_monitor_data.php
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012 Carlos Cesario - carloscesario@gmail.com
+ All rights reserved.
+ */
/* ========================================================================== */
/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/* ========================================================================== */
-
# ------------------------------------------------------------------------------
# Defines
# ------------------------------------------------------------------------------
@@ -42,13 +41,77 @@ require_once("guiconfig.inc");
# ------------------------------------------------------------------------------
if ($_POST) {
# Actions
+ $filter = preg_replace('/(@|!|>|<)/',"",htmlspecialchars($_POST['strfilter']));
switch (strtolower($_POST['program'])) {
case 'squid':
- showSquid();
- break;
- case 'sguard';
- showSGuard();
- break;
+ // Define log file
+ $log='/var/squid/logs/access.log';
+ //show table headers
+ show_tds(array("Date","IP","Status","Address","User","Destination"));
+ //fetch lines
+ $logarr=fetch_log($log);
+ // Print lines
+ foreach ($logarr as $logent) {
+ // 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]);
+
+ // Remove /(slash) in destination row
+ $logline_dest = preg_split("/\//", $logline[9]);
+
+ // Apply filter and color
+ // Need validate special chars
+ if ($filter != "")
+ $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);
+
+
+ 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;
}
}
@@ -74,116 +137,31 @@ function html_autowrap($cont)
// Show Squid Logs
-function showSquid() {
- // Define log file
- $squid_log='/var/squid/logs/access.log';
-
- echo "<tr valign=\"top\">\n";
- echo "<td class=\"listhdrr\">".gettext("Date")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("IP")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("Status")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("Address")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("User")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("Destination")."</td>\n";
- echo "</tr>\n";
-
- // Get Data from form post
+function fetch_log($log){
+ global $filter;
+ // Get Data from form post
$lines = $_POST['maxlines'];
- $filter = $_POST['strfilter'];
-
-
- // Get logs based in filter expression
- if($filter != "") {
- exec("tail -r -n $lines $squid_log | php -q parser_squid_log.php | grep -i ". escapeshellarg(htmlspecialchars($filter)), $logarr);
- }
- else {
- exec("tail -r -n $lines $squid_log | php -q parser_squid_log.php", $logarr);
- }
-
- // Print lines
- foreach ($logarr as $logent) {
- // 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]);
-
- // Remove /(slash) in destination row
- $logline_dest = preg_split("/\//", $logline[9]);
-
- // Apply filter and color
- // Need validate special chars
- if ($filter != "")
- $logline = preg_replace("/$filter/i","<spam><font color='red'>$filter</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";
- }
-}
-
-// Show SquidGuard Logs
-function showSGuard() {
- // Define log file
- $sguard_log='/var/squidGuard/log/block.log';
-
- echo "<tr valign=\"top\">\n";
- echo "<td class=\"listhdrr\">".gettext("Date-Time")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("ACL")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("Address")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("Host")."</td>\n";
- echo "<td class=\"listhdrr\">".gettext("User")."</td>\n";
- echo "</tr>\n";
-
- // Get Data from form post
- $lines = $_POST['maxlines'];
- $filter = $_POST['strfilter'];
-
+ if (preg_match("/!/",htmlspecialchars($_POST['strfilter'])))
+ $grep_arg="-iv";
+ else
+ $grep_arg="-i";
// Get logs based in filter expression
if($filter != "") {
- exec("tail -r -n $lines $sguard_log | grep -i ". escapeshellarg(htmlspecialchars($filter)), $logarr);
+ exec("tail -2000 {$log} | /usr/bin/grep {$grep_arg} " . escapeshellarg($filter). " | tail -r -n $lines | php -q squid_log_parser.php " , $logarr);
}
else {
- exec("tail -r -n $lines $sguard_log", $logarr);
- }
-
-
- // Print lines
- 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/","<spam><font color='red'>$filter</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";
+ exec("tail -r -n {$lines} {$log} | php -q squid_log_parser.php", $logarr);
}
+ // return logs
+ return $logarr;
+};
+
+function show_tds($tds){
+ echo "<tr valign='top'>\n";
+ foreach ($tds as $td){
+ echo "<td class='listhdrr'>".gettext($td)."</td>\n";
+ }
+ echo "</tr>\n";
}
?>
diff --git a/config/squid-reverse/squid_nac.xml b/config/squid-reverse/squid_nac.xml
index c951b6f3..9371a0ba 100644
--- a/config/squid-reverse/squid_nac.xml
+++ b/config/squid-reverse/squid_nac.xml
@@ -80,6 +80,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse.xml b/config/squid-reverse/squid_reverse.xml
index ae0c0e8a..ce09f8e7 100644
--- a/config/squid-reverse/squid_reverse.xml
+++ b/config/squid-reverse/squid_reverse.xml
@@ -84,6 +84,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_general.xml b/config/squid-reverse/squid_reverse_general.xml
index ff74b9d5..ec0bcb7a 100644
--- a/config/squid-reverse/squid_reverse_general.xml
+++ b/config/squid-reverse/squid_reverse_general.xml
@@ -64,6 +64,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php?menu=reverse</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_reverse_sync.xml&amp;id=0</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_peer.xml b/config/squid-reverse/squid_reverse_peer.xml
index fb853eb3..6341567e 100644
--- a/config/squid-reverse/squid_reverse_peer.xml
+++ b/config/squid-reverse/squid_reverse_peer.xml
@@ -64,6 +64,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php?menu=reverse</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_reverse_sync.xml&amp;id=0</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_sync.xml b/config/squid-reverse/squid_reverse_sync.xml
index d666d4e8..408f14f1 100755
--- a/config/squid-reverse/squid_reverse_sync.xml
+++ b/config/squid-reverse/squid_reverse_sync.xml
@@ -59,6 +59,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php?menu=reverse</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_reverse_sync.xml&amp;id=0</url>
<active/>
diff --git a/config/squid-reverse/squid_reverse_uri.xml b/config/squid-reverse/squid_reverse_uri.xml
index a7a5a6d6..e2d64fe9 100644
--- a/config/squid-reverse/squid_reverse_uri.xml
+++ b/config/squid-reverse/squid_reverse_uri.xml
@@ -64,6 +64,10 @@
<active/>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php?menu=reverse</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_reverse_sync.xml&amp;id=0</url>
</tab>
diff --git a/config/squid-reverse/squid_sync.xml b/config/squid-reverse/squid_sync.xml
index c581d2c5..62a726f4 100755
--- a/config/squid-reverse/squid_sync.xml
+++ b/config/squid-reverse/squid_sync.xml
@@ -75,6 +75,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
<active/>
diff --git a/config/squid-reverse/squid_traffic.xml b/config/squid-reverse/squid_traffic.xml
index b1799cce..62269792 100644
--- a/config/squid-reverse/squid_traffic.xml
+++ b/config/squid-reverse/squid_traffic.xml
@@ -80,6 +80,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_upstream.xml b/config/squid-reverse/squid_upstream.xml
index 126a0710..049d301c 100644
--- a/config/squid-reverse/squid_upstream.xml
+++ b/config/squid-reverse/squid_upstream.xml
@@ -81,6 +81,10 @@
<url>/pkg.php?xml=squid_users.xml</url>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>
diff --git a/config/squid-reverse/squid_users.xml b/config/squid-reverse/squid_users.xml
index 295ce4fa..791a5fa9 100644
--- a/config/squid-reverse/squid_users.xml
+++ b/config/squid-reverse/squid_users.xml
@@ -82,6 +82,10 @@
<active/>
</tab>
<tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php</url>
+ </tab>
+ <tab>
<text>Sync</text>
<url>/pkg_edit.php?xml=squid_sync.xml</url>
</tab>