[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.

Content-Type: text/plain;
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.


Content-Type: application/x-perl;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;

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);
	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");