Earindil has asked for the wisdom of the Perl Monks concerning the following question:
$FLAG = 0; # Get last timestamp if (-e "$OutputDir/$NAME/last_timestamp") { open LAST, "<$OutputDir/$NAME/last_timestamp"; $last_timestamp = <LAST>; chomp $last_timestamp; close LAST; } else { # Prime the Pump $data = `tail -1 $LOG`; @data = split(/\ /,$data); open LAST, ">$OutputDir/$NAME/last_timestamp"; print LAST "$data[3]"; close LAST; exit; } if (-e "$LOG") { open LOG, "<$LOG"; while (<LOG>) { @data = split(/\ /); next if (($data[3] ne $last_timestamp)&&($last +_timestamp)&&(!$FLAG)); $FLAG=1; next if (($skip)&&($_ =~ m/$skip/)); $last_timestamp = $data[3]; $login_id{$data[2]}++; } close LOG; @Result = keys %login_id; print "USERS=$#Result\n"; open LAST, ">$OutputDir/$NAME/last_timestamp"; print LAST "$last_timestamp"; close LAST; } else { print "LOG FILE NOT FOUND\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: tracking unique users in a weblog
by merlyn (Sage) on Jan 22, 2004 at 17:05 UTC | |
by Earindil (Beadle) on Jan 22, 2004 at 17:28 UTC | |
|
Re: tracking unique users in a weblog
by Abigail-II (Bishop) on Jan 22, 2004 at 17:12 UTC | |
|
(z) Re: tracking unique users in a weblog
by zigdon (Deacon) on Jan 22, 2004 at 17:49 UTC | |
by Earindil (Beadle) on Jan 22, 2004 at 18:47 UTC | |
by Earindil (Beadle) on Jan 22, 2004 at 18:21 UTC | |
|
Re: tracking unique users in a weblog
by CountZero (Bishop) on Jan 22, 2004 at 22:33 UTC |