Revision: 6352
http://ipcop.svn.sourceforge.net/ipcop/?rev=6352&view=rev
Author: dotzball
Date: 2012-02-17 12:59:59 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
Show squidGuard logs in logsystem.cgi.
Cosmetic changes
Modified Paths:
--------------
ipcop/trunk/html/cgi-bin/logsystem.cgi
ipcop/trunk/html/cgi-bin/logurlfilter.cgi
Modified: ipcop/trunk/html/cgi-bin/logsystem.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/logsystem.cgi 2012-02-17 08:45:41 UTC (rev
6351)
+++ ipcop/trunk/html/cgi-bin/logsystem.cgi 2012-02-17 12:59:59 UTC (rev
6352)
@@ -67,6 +67,7 @@
'ipsec' => '(vpn|ipsec|ipsec_[\w_]+|pluto\[\d+\]|vpn-watch)',
'openvpn' => '(vpn|openvpn|OVPN_.*|openvpnserver\[\d+\])',
'squid' => '(squid\[\d+\])',
+ 'squidGuard' => '(squidGuard\[\d+\])',
'installpackage' => '(installpackage|installpackage\[urlfilter\])',
'traffic' => '(accountingctrl|aggregate|vnstatd\[\d+\])',
);
@@ -85,6 +86,7 @@
'ipsec' => 'IPsec',
'openvpn' => 'OpenVPN',
'squid' => "$Lang::tr{'proxy'}",
+ 'squidGuard' => "SquidGuard",
'installpackage' => "$Lang::tr{'update transcript'}",
'traffic' => "$Lang::tr{'sstraffic'}",
);
Modified: ipcop/trunk/html/cgi-bin/logurlfilter.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/logurlfilter.cgi 2012-02-17 08:45:41 UTC (rev
6351)
+++ ipcop/trunk/html/cgi-bin/logurlfilter.cgi 2012-02-17 12:59:59 UTC (rev
6352)
@@ -59,7 +59,6 @@
$cgiparams{'DAY'} = $now[3];
$cgiparams{'MONTH'} = $now[4];
-$cgiparams{'SECTION'} = 'urlfilter';
$cgiparams{'CATEGORY'} = 'ALL';
$cgiparams{'SOURCE_IP'} = 'ALL';
$cgiparams{'USERNAME'} = 'ALL';
@@ -77,13 +76,12 @@
my @temp_then = ();
if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) {
@temp_then = split(',', $ENV{'QUERY_STRING'});
- $start = $temp_then[0];
- $cgiparams{'MONTH'} = $temp_then[1];
- $cgiparams{'DAY'} = $temp_then[2];
- $cgiparams{'SECTION'} = $temp_then[3];
- $cgiparams{'CATEGORY'} = $temp_then[4];
- $cgiparams{'SOURCE_IP'} = $temp_then[5];
- $cgiparams{'USERNAME'} = $temp_then[6];
+ $start = $temp_then[0];
+ $cgiparams{'MONTH'} = $temp_then[1];
+ $cgiparams{'DAY'} = $temp_then[2];
+ $cgiparams{'CATEGORY'} = $temp_then[3];
+ $cgiparams{'SOURCE_IP'} = $temp_then[4];
+ $cgiparams{'USERNAME'} = $temp_then[5];
}
if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/)
@@ -129,15 +127,12 @@
print "IPCop URL filter log\r\n";
print "$Lang::tr{'section'}: $cgiparams{'SECTION'}\n";
print "$Lang::tr{'date'}: $date\r\n\r\n";
-
- unless ($cgiparams{'SECTION'} eq 'squidGuard')
- {
- print "Category: $cgiparams{'CATEGORY'}\r\n";
- print "Client: $cgiparams{'SOURCE_IP'}\r\n";
- if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
- print "Username: $cgiparams{'USERNAME'}\r\n";
- }
+ print "Category: $cgiparams{'CATEGORY'}\r\n";
+ print "Client: $cgiparams{'SOURCE_IP'}\r\n";
+ if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
+ print "Username: $cgiparams{'USERNAME'}\r\n";
}
+
print "\r\n";
# Do not reverse log when exporting
@@ -156,21 +151,16 @@
{
print "$date ";
print "$time ";
- if ($cgiparams{'SECTION'} eq 'squidGuard')
- {
- print "$pid ";
- print "@loginfo";
- print "\n";
+ print "$category[1] ";
+ print "$ip[0] ";
+ if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
+ print "$loginfo[3] ";
}
- else {
- print "$category[1] ";
- print "$ip[0] ";
- if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') { print
"$loginfo[3] "; }
- print "$dsturl";
- print "\n";
- }
+ print "$dsturl";
+ print "\n";
+
}
- }
+ }
exit;
}
@@ -189,33 +179,15 @@
&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:");
-my %selected = ();
-$selected{'SECTION'}{'urlfilter'} = '';
-$selected{'SECTION'}{'squidGuard'} = '';
-$selected{'SECTION'}{$cgiparams{'SECTION'}} = "selected='selected'";
-
-if ($cgiparams{'SECTION'} eq 'squidGuard')
-{
- $cgiparams{'SOURCE_IP'} = 'ALL';
- $cgiparams{'CATEGORY'} = 'ALL';
- $cgiparams{'USERNAME'} = 'ALL';
-}
-
print <<END
<form method='post' action="$ENV{'SCRIPT_NAME'}">
<table width='100%'>
<tr>
- <td class='base' nowrap='nowrap'>$Lang::tr{'section'}: </td>
- <td>
- <select name='SECTION' onchange='this.form.submit()'>
- <option value='urlfilter'
$selected{'SECTION'}{'urlfilter'}>$Lang::tr{'url filter'}</option>
- <option value='squidGuard'
$selected{'SECTION'}{'squidGuard'}>squidGuard</option>
- </select>
+ <td width='5%' class='base' nowrap='nowrap'>
+ $Lang::tr{'month'}:
</td>
- <td class='base' nowrap='nowrap'> $Lang::tr{'month'}:
- </td>
- <td>
- <select name='MONTH'>
+ <td width='20%'>
+ <select name='MONTH'>
END
;
for (my $month = 0; $month < 12; $month++)
@@ -227,11 +199,12 @@
print "value='$month'>$Lang::tr{$General::longMonths[$month]}</option>\n";
}
print <<END
- </select>
+ </select>
</td>
- <td class='base' nowrap='nowrap'> $Lang::tr{'day'}:
+ <td width='5%' class='base' nowrap='nowrap'>
+ $Lang::tr{'day'}:
</td>
- <td>
+ <td width='20%'>
<select name='DAY'>
END
;
@@ -245,20 +218,21 @@
print <<END
</select>
</td>
- <td>
-
- </td>
- <td align='center'>
+ <td width='5%'></td>
+ <td width='40%'>
<input type='submit' name='ACTION' title='$Lang::tr{'day before'}'
value='<<' />
<input type='submit' name='ACTION' title='$Lang::tr{'day after'}'
value='>>' />
<input type='submit' name='ACTION' value='$Lang::tr{'update'}' />
<input type='submit' name='ACTION' value='$Lang::tr{'export'}' /></td>
- <td class='onlinehelp'>
+ <td width='5%' class='onlinehelp'>
<a href='${General::adminmanualurl}/logs-urlfilter.html'
target='_blank'><img src='/images/web-support.png' alt='$Lang::tr{'online help
en'}' title='$Lang::tr{'online help en'}' /></a>
</td>
</tr>
-</table>
-<hr />
+<tr>
+ <td colspan=7>
+ <hr />
+ </td>
+</tr>
END
;
@@ -268,12 +242,11 @@
}
print <<END
-<table width='100%'>
<tr>
- <td width='5%' class='base'
nowrap='nowrap'>$Lang::tr{'category'}: </td>
- <td width='20%'>
- <select name='CATEGORY'>
- <option value='ALL' $selectedAllCat>$Lang::tr{'caps all'}</option>
+ <td class='base' nowrap='nowrap'>$Lang::tr{'category'}: </td>
+ <td>
+ <select name='CATEGORY'>
+ <option value='ALL' $selectedAllCat>$Lang::tr{'caps all'}</option>
END
;
foreach my $cat (sort(keys %categories)) {
@@ -284,19 +257,13 @@
print "<option value='$cat' $selected>$cat</option>\n";
}
print <<END
- </select>
+ </select>
</td>
- <td width='5%' class='base'
nowrap='nowrap'> $Lang::tr{'client'}: </td>
+ <td class='base' nowrap='nowrap'>$Lang::tr{'client'}: </td>
+ <td>
END
;
-if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
- print "<td width='20%'>\n";
-}
-else {
- print "<td width='70%'>\n";
-}
-
my $selectedAllSrcIp = '';
if($cgiparams{'SOURCE_IP'} eq 'ALL') {
$selectedAllSrcIp = "selected='selected'";
@@ -317,19 +284,26 @@
print <<END
</select>
</td>
+ <td class='base' nowrap='nowrap'>
END
;
if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
+ print "$Lang::tr{'username'}: \n";
+}
+
+print <<END
+ </td>
+ <td colspan=2>
+END
+;
+if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
my $selectedAllUser = '';
if($cgiparams{'USERNAME'} eq 'ALL') {
$selectedAllUser = "selected='selected'";
}
-
- print <<END
- <td width='5%' class='base'
nowrap='nowrap'> $Lang::tr{'username'}: </td>
- <td width='45%'>
- <select name='USERNAME'>
+ print <<END
+ <select name='USERNAME'>
<option value='ALL' $selectedAllUser>$Lang::tr{'caps all'}</option>
END
;
@@ -341,15 +315,13 @@
print "<option value='$user' $selected>$user</option>\n";
}
- print <<END
- </select>
- </td>
-END
-;
+ print "</select>\n";
}
+
print <<END
-</tr>
+ </td>
+ </tr>
</table>
</form>
END
@@ -391,12 +363,12 @@
@log = reverse @log;
}
-if ($lines != 0) { &oldernewer(); }
-
-if ($cgiparams{'SECTION'} eq 'urlfilter') {
- print "<b>$Lang::tr{'web hits'} $year
$Lang::tr{$General::longMonths[$cgiparams{'MONTH'}]} $daystr:
$lines</b>\n<p>\n";
+if ($lines != 0) {
+ &oldernewer();
}
+print "<b>$Lang::tr{'web hits'} $year
$Lang::tr{$General::longMonths[$cgiparams{'MONTH'}]} $daystr:
$lines</b>\n<p>\n";
+
my @slice = splice(@log, $start, $offset);
if ($lines)
@@ -404,9 +376,7 @@
$lines = 0;
print "<table width='100%'>\n";
- unless ($cgiparams{'SECTION'} eq 'squidGuard')
- {
- print <<END
+ print <<END
<tr>
<td align='center'><b>$Lang::tr{'time'}</b></td>
@@ -414,16 +384,16 @@
<td align='center'><b>$Lang::tr{'client'}</b></td>
END
;
- if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
- print "<td align='center'><b>$Lang::tr{'username'}</b></td>\n";
- }
- print <<END
+ if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on') {
+ print "<td align='center'><b>$Lang::tr{'username'}</b></td>\n";
+ }
+ print <<END
<td align='center'><b>$Lang::tr{'destination'}</b></td>
</tr>
END
;
- }
+
foreach $_ (@slice)
{
my $attr1 = '';
@@ -441,43 +411,32 @@
{
$lines++;
- if ($cgiparams{'SECTION'} eq 'squidGuard') {
- if ($loginfo[0] =~ /squidGuard/) { $attr1 .= "<b>"; $attr2 .=
"</b>"; }
- if ($loginfo[1] =~ /ready/) { $attr1 .= "<b><font
color='$Header::colourgreen'>"; $attr2 .= "</font></b>"; }
- if ($loginfo[2] =~ /emergency/) { $attr1 .= "<b><font
color='$Header::colourerr'>"; $attr2 .= "</font></b>"; }
- print "<tr>\n";
+ if ($lines % 2) {
+ print "<tr class='table1colour'>\n";
}
else {
- if ($lines % 2) {
- print "<tr class='table1colour'>\n";
- }
- else {
- print "<tr class='table2colour'>\n";
- }
+ print "<tr class='table2colour'>\n";
}
- if ($cgiparams{'SECTION'} eq 'squidGuard') {
- print "<td nowrap>$time $pid
$attr1@loginfo$attr2</td>\n";
+
+ print "<td width='10%' align='center' nowrap>$time</td>\n";
+ print "<td width='11%' align='center' nowrap>$category[1]</td>\n";
+ print "<td width='15%' align='center' nowrap>$ip[0]</td>\n";
+ my $site = '';
+ if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on')
+ {
+ print "<td width='12%' align='center'
nowrap>$loginfo[3]</td>\n";
+ $site = substr($dsturl,0,55);
+ if (length($dsturl) > 55) { $site .= "..."; }
}
else {
- print "<td width='10%' align='center' nowrap>$time</td>\n";
- print "<td width='11%' align='center'
nowrap>$category[1]</td>\n";
- print "<td width='15%' align='center' nowrap>$ip[0]</td>\n";
- my $site = '';
- if ($filtersettings{'ENABLE_USERNAME_LOG'} eq 'on')
- {
- print "<td width='12%' align='center'
nowrap>$loginfo[3]</td>\n";
- $site = substr($dsturl,0,55);
- if (length($dsturl) > 55) { $site .= "..."; }
+ $site = substr($dsturl,0,69);
+ if (length($dsturl) > 69) {
+ $site .= "...";
}
- else {
- $site = substr($dsturl,0,69);
- if (length($dsturl) > 69) {
- $site .= "...";
- }
- }
- print "<td><a href='$dsturl' title='$dsturl'
target='_blank'>$site</a></td>\n";
}
+ print "<td><a href='$dsturl' title='$dsturl'
target='_blank'>$site</a></td>\n";
+
print "</tr>\n";
}
}
@@ -501,78 +460,53 @@
my $filestr='';
undef @log;
- if ($cgiparams{'SECTION'} eq 'squidGuard')
+
+ foreach my $logarch (<$logdir/*>)
{
- $filestr = "$logdir/squidGuard.log";
- foreach my $logarch (<$filestr*>)
- {
+ if ($logarch !~ /squidGuard\.log/) {
if($logarch =~ /\.gz$/) {
open (LOG, "gzip -dc $logarch |");
}
else {
open (LOG, $logarch);
}
-
foreach (<LOG>) {
my ($date,$time,$pid,@loginfo) = split(/ /);
my ($logyear,$logmonth,$logday) = split(/-/,$date);
+ @category = split(/\//,$loginfo[0]);
+ $categories{$category[1]}++;
+ @ip = split(/\//,$loginfo[2]);
+ $ips{$ip[0]}++;
+ $loginfo[3] =~ s/\%5c/\\/;
+ $usernames{$loginfo[3]}++;
if (($logyear == $year)
&& ($logmonth == $cgiparams{'MONTH'}+1)
&& ($logday == $cgiparams{'DAY'})) {
- push(@log, $_)
+ push(@log,$_)
}
}
close(LOG);
}
}
- else {
- foreach my $logarch (<$logdir/*>)
- {
- if ($logarch !~ /squidGuard\.log/) {
- if($logarch =~ /\.gz$/) {
- open (LOG, "gzip -dc $logarch |");
- }
- else {
- open (LOG, $logarch);
- }
- foreach (<LOG>) {
- my ($date,$time,$pid,@loginfo) = split(/ /);
- my ($logyear,$logmonth,$logday) = split(/-/,$date);
- @category = split(/\//,$loginfo[0]);
- $categories{$category[1]}++;
- @ip = split(/\//,$loginfo[2]);
- $ips{$ip[0]}++;
- $loginfo[3] =~ s/\%5c/\\/;
- $usernames{$loginfo[3]}++;
- if (($logyear == $year)
- && ($logmonth == $cgiparams{'MONTH'}+1)
- && ($logday == $cgiparams{'DAY'})) {
- push(@log,$_)
- }
- }
- close(LOG);
- }
- }
-
- my @temp = ();
- foreach (@log)
+ my @temp = ();
+ foreach (@log)
+ {
+ my ($date,$time,$pid,@loginfo) = split(/ /);
+ @ip = split(/\//,$loginfo[2]);
+ @category = split(/\//,$loginfo[0]);
+ $loginfo[3] =~ s/\%5c/\\/;
+ if ((($cgiparams{'CATEGORY'} eq 'ALL') || ($category[1] eq
$cgiparams{'CATEGORY'}))
+ && (($cgiparams{'SOURCE_IP'} eq 'ALL') || ($ip[0] eq
$cgiparams{'SOURCE_IP'}))
+ && (($cgiparams{'USERNAME'} eq 'ALL') || ($loginfo[3] eq
$cgiparams{'USERNAME'})))
{
- my ($date,$time,$pid,@loginfo) = split(/ /);
- @ip = split(/\//,$loginfo[2]);
- @category = split(/\//,$loginfo[0]);
- $loginfo[3] =~ s/\%5c/\\/;
- if ((($cgiparams{'CATEGORY'} eq 'ALL') || ($category[1] eq
$cgiparams{'CATEGORY'}))
- && (($cgiparams{'SOURCE_IP'} eq 'ALL') || ($ip[0] eq
$cgiparams{'SOURCE_IP'}))
- && (($cgiparams{'USERNAME'} eq 'ALL') || ($loginfo[3] eq
$cgiparams{'USERNAME'})))
- {
- push(@temp,$_);
- }
+ push(@temp,$_);
}
- @log = @temp;
- @log = sort { substr($a,11,8) cmp substr($b,11,8) } @log;
}
+ @log = @temp;
+ @log = sort { substr($a,11,8) cmp substr($b,11,8) } @log;
+
}
# -------------------------------------------------------------------
@@ -586,7 +520,7 @@
;
if ($prev != -1) {
- print "<a
href='$ENV{'SCRIPT_NAME'}?$prev,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'},$cgiparams{'CATEGORY'},$cgiparams{'SOURCE_IP'},$cgiparams{'USERNAME'}'>$Lang::tr{'older'}</a>";
+ print "<a
href='$ENV{'SCRIPT_NAME'}?$prev,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'CATEGORY'},$cgiparams{'SOURCE_IP'},$cgiparams{'USERNAME'}'>$Lang::tr{'older'}</a>";
}
else {
print "$Lang::tr{'older'}";
@@ -595,7 +529,7 @@
print "<td align='center' width='50%'>";
if ($next >= 0) {
- print "<a
href='$ENV{'SCRIPT_NAME'}?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'SECTION'},$cgiparams{'CATEGORY'},$cgiparams{'SOURCE_IP'},$cgiparams{'USERNAME'}'>$Lang::tr{'newer'}</a>";
+ print "<a
href='$ENV{'SCRIPT_NAME'}?$next,$cgiparams{'MONTH'},$cgiparams{'DAY'},$cgiparams{'CATEGORY'},$cgiparams{'SOURCE_IP'},$cgiparams{'USERNAME'}'>$Lang::tr{'newer'}</a>";
}
else {
print "$Lang::tr{'newer'}";
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn