[LON-CAPA-dev] Mining log data
B. Minaei
lon-capa-dev@mail.lon-capa.org
Wed, 23 Oct 2002 14:56:53 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_0014_01C27AA4.6CAABFF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi Mark,
> I am trying to track down a student problem. I am looking at
> information in activity.log, http logs, lond, lonnet, etc...
> Does anybody have a perl script that pulls all of this together,
> or at least some part of it?
The attachment script file may help you.
Behrouz
------=_NextPart_000_0014_01C27AA4.6CAABFF0
Content-Type: application/x-perl;
name="parsActivityLog.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="parsActivityLog.pl"
use strict;
sub unescape {
my $str=shift;
$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
return $str;
}
sub main {
my $file=$ARGV[0];
print "Using $file\n";
open(FILEID, "<$file");
my $line;
my @allaccess;
while ($line=<FILEID>) {
my ($time,$machine,$what)=split(':',$line);
$what=&unescape($what);
my @accesses=split('&',$what);
foreach my $access (@accesses) {
my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
if (!$resource) { next; }
push (@allaccess,unescape($access));
}
}
foreach my $access (@allaccess) {
my ($date,$resource,$who,$domain,$post,@posts)=split(':',$access);
print(localtime($date)." $who -> $resource\n");
if ($post) {
print("Sent data ".join(':',unescape(@posts))."\n");
}
}
}
main;
------=_NextPart_000_0014_01C27AA4.6CAABFF0--