> Is there a way to log the search 
> entries entered in htdig? If there isn't I think I would be a cool tool 
> to have and beside a real easy one to implement.

There have been several patches submitted to the mailing list to do this.
Another way is to filter the entries in your web server log and generate
a report.  No claim that this is the most elegant or efficient way to do
this but it works for me:

#!/usr/bin/perl -T
$log="path/to/your/webserver/logfile";
$day=(localtime)[3];
$month=(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime)[4]];
open (FILE, $log);

while (<FILE>)  {
   if (/htsearch/&&/$day\/$month/){
      #($host, $RFC, $authuser, $timestamp, $TZ, $get, $url, $protocol, $status , 
$size) = split;
      ($host, $RFC, $authuser, $timestamp, $TZ, $get, $url) = split,6;
      @a=(split/&/,$url);
      ++$line_counter;
      foreach $b (@a){
         $b=~s%\/cgi-bin\/htsearch\?%%;
         $b =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
            if ($b =~ /words=/i){
               $b =~ s/words=//i;
               $b =~ s/\+/ /g;
               $words[$line_counter]=$b;
            }

            if ($b =~ /restrict=/i){
               $b =~ s/restrict=//i;
               $restrict[$line_counter]=$b;
            }
            

            if ($b =~ /config=/i){
               $b =~ s/config=//i;
               $config[$line_counter]=$b;
            }
              

            if ($b =~ /format=/i){
               $b =~ s/format=//i;
               $format[$line_counter]=$b;
            }
            

            if ($b =~ /method=/i){
               $b =~ s/method=//i;
               $method[$line_counter]=$b;
            }
            

            if ($b =~ /page=/i){
               $b =~ s/page=//i;
               $page[$line_counter]=$b;
            }
            if ($b =~ /exclude=/i){
               $b =~ s/exclude=//i;
               $exclude[$line_counter]=$b;
            }
         }
      }
    }

print "-------------------------------\n";
print "Words:\n";
print "   Format:  Method:  Page:(if any)\n";
print "   Config:\n";
print "   Restrict:(if any)\n";
print "   Exclude:(if any)\n";
print "-------------------------------\n";

       for($i = 1; $i<$line_counter; $i++){
           write();
       }


format STDOUT =
~ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$words[$i]
   ~ @<<<<<<<<<<<< @<<<<<<<<<<< @<<<
   $format[$i]   $method[$i]    $page[$i]
   ~ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   $config[$i]
   ~ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   $restrict[$i]
   ~ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   $exclude[$i]

Reply via email to