aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-11 10:24:57 -0700
committerMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-11 10:24:57 -0700
commitf44c04513857b4bf81dbcbd0adcc7f5f5cda835e (patch)
tree632c5f5330d13e386c02b77eade29d9ec3ac44d6 /config
parent066c6309f567d21e046a999663437c323d39ed77 (diff)
parentef305868daedee0a9f67a2dcfe2bf5779cce5312 (diff)
downloadpfsense-packages-f44c04513857b4bf81dbcbd0adcc7f5f5cda835e.tar.gz
pfsense-packages-f44c04513857b4bf81dbcbd0adcc7f5f5cda835e.tar.bz2
pfsense-packages-f44c04513857b4bf81dbcbd0adcc7f5f5cda835e.zip
Merge pull request #255 from ccesario/master
Enable squid_log_parser.php only to squid program
Diffstat (limited to 'config')
-rw-r--r--config/squid-reverse/squid_monitor_data.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/config/squid-reverse/squid_monitor_data.php b/config/squid-reverse/squid_monitor_data.php
index fcd5d178..7e27919d 100644
--- a/config/squid-reverse/squid_monitor_data.php
+++ b/config/squid-reverse/squid_monitor_data.php
@@ -42,7 +42,8 @@ require_once("guiconfig.inc");
if ($_POST) {
# Actions
$filter = preg_replace('/(@|!|>|<)/',"",htmlspecialchars($_POST['strfilter']));
- switch (strtolower($_POST['program'])) {
+ $program = strtolower($_POST['program']);
+ switch ($program) {
case 'squid':
// Define log file
$log='/var/squid/logs/access.log';
@@ -138,19 +139,26 @@ function html_autowrap($cont)
// Show Squid Logs
function fetch_log($log){
- global $filter;
+ global $filter,$program;
// Get Data from form post
$lines = $_POST['maxlines'];
if (preg_match("/!/",htmlspecialchars($_POST['strfilter'])))
$grep_arg="-iv";
else
$grep_arg="-i";
+
+ //Check program to execute or no the parser
+ if($program == "squid")
+ $parser = "| php -q squid_log_parser.php";
+ else
+ $parser = "";
+
// Get logs based in filter expression
if($filter != "") {
- exec("tail -2000 {$log} | /usr/bin/grep {$grep_arg} " . escapeshellarg($filter). " | tail -r -n $lines | php -q squid_log_parser.php " , $logarr);
+ exec("tail -2000 {$log} | /usr/bin/grep {$grep_arg} " . escapeshellarg($filter). " | tail -r -n {$lines} {$parser} " , $logarr);
}
else {
- exec("tail -r -n {$lines} {$log} | php -q squid_log_parser.php", $logarr);
+ exec("tail -r -n {$lines} {$log} {$parser}", $logarr);
}
// return logs
return $logarr;