version 1.3, 2004/09/08 19:41:23
|
version 1.7, 2005/03/30 18:04:53
|
Line 5 use lib '/home/httpd/lib/perl/';
|
Line 5 use lib '/home/httpd/lib/perl/';
|
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
use Date::Manip; |
use Date::Manip; |
|
|
my $start_time=&UnixDate("Aug 30th 00:00:00 2004","%s"); |
my $start_time=&UnixDate("Mar 30th 00:00:00 2004","%s"); |
my @counts=('1','10','100','1000','10000','100000','250000'); |
my @counts=('1','10','100','1000','10000','100000','250000','1000000'); |
|
|
|
|
sub only_user_activitylog_files { |
sub only_user_activitylog_files { |
Line 16 sub only_user_activitylog_files {
|
Line 16 sub only_user_activitylog_files {
|
|
|
my %data; |
my %data; |
my $numusers; |
my $numusers; |
|
my %machine; |
sub process_activitylog_file { |
sub process_activitylog_file { |
if ($File::Find::dir=~m|/\d/\d/\d/|) { return; } |
if ($File::Find::dir=~m|/\d/\d/\d/|) { return; } |
if ($_ ne 'activity.log') { return; } |
if ($_ ne 'activity.log') { return; } |
Line 24 sub process_activitylog_file {
|
Line 25 sub process_activitylog_file {
|
my $user=(split('/',$File::Find::dir))[-1]; |
my $user=(split('/',$File::Find::dir))[-1]; |
while (my $line=<FILE>) { |
while (my $line=<FILE>) { |
if ($line !~ /Login/) { next; } |
if ($line !~ /Login/) { next; } |
my ($date)=split(':',$line,2); |
my ($date,$machine)=split(':',$line,3); |
if ($date > $start_time) { push (@{$data{$date}},$user); } |
if ($date > $start_time) { |
|
push (@{$data{$date}},$user); |
|
$machine{$machine}++; |
|
} |
} |
} |
if ($numusers%100 == 0) { |
if ($numusers%100 == 0) { |
print "\b\b\b\b\b\b\b\b\b\b\b\b\b\bDid $user"; |
print "\b\b\b\b\b\b\b\b\b\b\b\b\b\bDid $user"; |
Line 41 sub print_data {
|
Line 45 sub print_data {
|
$total_login+=scalar(@{$data{$key}}); |
$total_login+=scalar(@{$data{$key}}); |
my $day=strftime('%F',localtime($key)); |
my $day=strftime('%F',localtime($key)); |
$byday{$day}+=scalar(@{$data{$key}}); |
$byday{$day}+=scalar(@{$data{$key}}); |
while ($total_login >= $counts[0]) { |
while ($counts[0] && $total_login >= $counts[0]) { |
print("The $counts[0] ($total_login) login was ". |
print("The $counts[0] ($total_login) login was ". |
join(', ',@{$data{$key}})."\n"); |
join(', ',@{$data{$key}})."\n"); |
shift(@counts); |
shift(@counts); |
Line 52 sub print_data {
|
Line 56 sub print_data {
|
print("$key -> $byday{$key}\n"); |
print("$key -> $byday{$key}\n"); |
} |
} |
print("total -> $total_login\n"); |
print("total -> $total_login\n"); |
|
print("\nMachine Logins\n"); |
|
foreach my $key (sort(keys(%machine))) { |
|
print("$key \t-> $machine{$key}\n"); |
|
} |
} |
} |
|
|
$|=1; |
$|=1; |