proxylog.dat ChangeLog for SWE3

Here are a few edits for the "web proxy" log page of a SmoothWall Express v3.0 Web Administration Console (GUI). These modifications have been tested with Smoothwall Express v3.0 with update 7 (SP2) and the Advanced Proxy Mod, version 3.0.5 by marco.s.


Warning: This modification requires several edits of a file on your system. This guide assumes you are comfortable editing files on your smoothie.


If you are not comfortable editing the file yourself, you can instead download a copy of my proxylog.dat file; it contains all edits listed below except for the username and DENIED filter edit. You can drop the file into your smoothie at /httpd/cgi-bin/logs.cgi/ (assuming you have the same version information listed above), and then change the permissions so it accessible from the web gui.

• it is a good idea to backup your proxylog.dat before replacing in case of any incompatibilities •
Backup proxylog.dat:
cp /httpd/cgi-bin/logs.cgi/proxylog.dat /httpd/cgi-bin/logs.cgi/proxylog.dat.original
Copy the downloaded proxylog.dat (note that the file is zipped, you will need to first unzip the file) to your smoothwall at /httpd/cgi-bin/logs.cgi/ using WinSCP or similar.
Set proxylog.dat permissions: (thanks to Igor for pointing out a typo)
chmod 755 /httpd/cgi-bin/logs.cgi/proxylog.dat

Keep in mind that your row numbers may not match up exactly if you have edited your proxylog.dat file previously or if you do not implement all of the customizations.

• as always, it is a good idea to backup your files before you begin editing, this can save you from a world of hurt if you make a mistake •
Backup proxylog.dat:
cp /httpd/cgi-bin/logs.cgi/proxylog.dat /httpd/cgi-bin/logs.cgi/proxylog.dat.original
Edit proxylog.dat:
joe /httpd/cgi-bin/logs.cgi/proxylog.dat
proxylog.dat Changes:
Fix log entry background color striping
(Row 326)
Find:
  if ($lines % 2) {
          print "<TR BGCOLOR='$table1colour'>\n"; }
  else {
          print "<TR BGCOLOR='$table2colour'>\n"; }

Replace with:
  if ($lines % 2) {
          print "<TR class='light'>\n"; }
  else {
          print "<TR class='dark'>\n"; }
Reverse timestamps (newest entry on top)
 ===========
== Display ==
 ===========
(Row 324)
Find:
  foreach $_ (@slice) 
  {

Replace with:
  while (scalar (@slice)) 
  { 
          $_ = pop(@slice);

 ==========
== Export ==
 ==========
(Row 124)
Find:
  foreach $_ (@log) {
          print "$_\n"; }

Replace with:
  while (scalar (@log)) {
          $_ = pop(@log);
          print "$_\n"; }
Sort client drop-down list (thank you to tegler on the forums for this edit)
(Row 189)
Find:
  my $ip;
  foreach $ip (keys %ips) {

Replace with:
  my $ip;
  for $ip (keys %ips){
          push (@ippool, $ip)
  }
  @ips = map {s/\s+//g; $_} sort map {s/(\d+)/sprintf "%3s", $1/eg; $_} @ippool;
  foreach $ip (@ips) {
Filter Change (to tell you the truth, I don't remember anymore what this change even does. You can probably skip this one.)
(Row 41)
Find:
  $cgiparams{'FILTER'} = "[.](gif|jpeg|jpg|png|ico|css|js)\$";

Replace with:
	$cgiparams{'FILTER'} = "[.](gif|jpeg|jpg|png|ico|css|js)\$\\??";
Add user name (only used if you have local user authentication enabled/setup)
(Row 100)
Find:
  my ($ts,$x,$ip,$cache,$y,$type,$url) = split;

Replace with:
  my ($ts,$x,$ip,$cache,$y,$type,$url,$fe) = split;

(Row 110)
Find:
  $log[$lines] = "$hour:$minute:$second $ip $url";

Replace with:
  $log[$lines] = "$hour:$minute:$second $ip $fe $url";

(Row 316)
Find:
  <th style='width: 10%;'>$tr{'time'}</th>
  <th style='width: 15%;'>$tr{'source ip'}</th>
  <th style='width: 75%;'>$tr{'website'}</th>

Replace with:
  <th style='width: 10%;'>$tr{'time'}</th> 
  <th style='width: 15%;'>$tr{'source ip'}</th> 
  <th style='width: 13%;'>$tr{'advproxy NCSA username'}</th> 
  <th style='width: 62%;'>$tr{'website'}</th>

(Row 332)
Find:
  my ($time,$ip,$url) = split; 
  $url =~ /(^.{0,80})/; 
  my $part = $1; 
  unless (length($part) < 80) { $part = "${part}..."; }

Replace with:
  my ($time,$ip,$fi,$url) = split; 
  if (($fi eq ' ') && (!($fe eq ' '))) { $fi=$fe; } 
  $url =~ /(^.{0,60})/; 
  my $part = $1; 
  unless (length($part) < 60) { $part = "${part}..."; }

(Row 338)
Find:
  <TD ALIGN='CENTER'>$time</TD> 
  <TD ALIGN='CENTER'>$ip</TD> 
  <TD ALIGN='LEFT'><A HREF='$url' TITLE='$url' TARGET='_new'>$part</A></TD>

Replace with:
  <TD ALIGN='CENTER' STYLE='padding-right: 7px;'>$time</TD>
  <TD ALIGN='CENTER' STYLE='padding-right: 7px;'>$ip</TD>
  <TD ALIGN='CENTER'>$fi</TD>
  <TD ALIGN='LEFT'><A HREF='$url' TITLE='$url' TARGET='_new'>$part</A></TD>
Add DENIED filter (only used if you have SQUID blocking access to websites)
(Row 196)
Find:
  <TR>
          <TD CLASS='base'>$tr{'ignore filterc'}</TD>
          <TD COLSPAN='3'><INPUT TYPE='text' NAME='FILTER' VALUE='$cgiparams{'FILTER'}' SIZE='40'></TD>
          <TD CLASS='base'>$tr{'enable ignore filterc'}</TD>
          <TD><INPUT TYPE='checkbox' NAME='ENABLE_FILTER' VALUE='on' $checked{'ENABLE_FILTER'}{'on'}></TD>
  </TR>

Replace with:
  <TR>
          <TD CLASS='base'>$tr{'ignore filterc'}</TD>
          <TD COLSPAN='3'><INPUT TYPE='text' NAME='FILTER' VALUE='$cgiparams{'FILTER'}' SIZE='40'></TD>
          <TD CLASS='base'>$tr{'enable ignore filterc'}</TD>
          <TD><INPUT TYPE='checkbox' NAME='ENABLE_FILTER' VALUE='on' $checked{'ENABLE_FILTER'}{'on'}></TD>
  </TR>
  <TR> 
          <TD COLSPAN='4'></TD>
          <TD CLASS='base'>Show only DENIED:</TD>
          <TD><INPUT TYPE='checkbox' NAME='ONLY_DENIED' VALUE='on' $checked{'ONLY_DENIED'}{'on'}></TD>
  </TR>

(Row 32)
Find:
  $cgiparams{'ENABLE_FILTER'} = 'off';

Replace with:
  cgiparams{'ENABLE_FILTER'} = 'off';
  $cgiparams{'ONLY_DENIED'} = 'off';

(Row 39)
Find:
  $cgiparams{'ENABLE_FILTER'} = 'on';

Replace with:
  $cgiparams{'ENABLE_FILTER'} = 'on';
  $cgiparams{'ONLY_DENIED'} = 'off';

(Row 47)
Find:
  $save{'ENABLE_FILTER'} = $cgiparams{'ENABLE_FILTER'};

Replace with:
  $save{'ENABLE_FILTER'} = $cgiparams{'ENABLE_FILTER'};
  $save{'ONLY_DENIED'} = $cgiparams{'ONLY_DENIED'}; 

(Row 125)
Find:
  if ($cgiparams{'ENABLE_FILTER'} eq 'on') {
          print "Ignore filter: $cgiparams{'FILTER'}\r\n"; }

Replace with:
  if ($cgiparams{'ENABLE_FILTER'} eq 'on') {
          print "Ignore filter: $cgiparams{'FILTER'}\r\n"; }
  if ($cgiparams{'ONLY_DENIED'} eq 'on') {
          print "Show only DENIED hits.\r\n"; }

(Row 139)
Find:
  $checked{'ENABLE_FILTER'}{'off'} = '';
  $checked{'ENABLE_FILTER'}{'on'} = '';
  $checked{'ENABLE_FILTER'}{$cgiparams{'ENABLE_FILTER'}} = 'CHECKED';

Replace with:
  $checked{'ENABLE_FILTER'}{'off'} = '';
  $checked{'ENABLE_FILTER'}{'on'} = '';
  $checked{'ENABLE_FILTER'}{$cgiparams{'ENABLE_FILTER'}} = 'CHECKED';
  
  $checked{'ONLY_DENIED'}{'off'} = '';
  $checked{'ONLY_DENIED'}{'on'} = '';
  $checked{'ONLY_DENIED'}{$cgiparams{'ONLY_DENIED'}} = 'CHECKED';

(Row 78)
Find:
  my $filter;   
  
  if ($cgiparams{'ENABLE_FILTER'} eq 'on') {
          $filter = $cgiparams{'FILTER'}; } 
  else {
          $filter = ''; }

Replace with:
  my $filter;   
  
  if ($cgiparams{'ENABLE_FILTER'} eq 'on') {
          $filter = $cgiparams{'FILTER'}; } 
  else {
          $filter = ''; }
  
  my $filter2;
  
  if ($cgiparams{'ONLY_DENIED'} eq 'on') {
          $filter2 = 'DENIED'; }
  else {
          $filter2 = '.*'; }

(Row 113)
Find:
  ((($ip eq $sourceip) || $sourceall)))

Replace with:
  ($cache =~ /$filter2/) && ((($ip eq $sourceip) || $sourceall)))
last updated: