I’ve had this script floating around for a while. It can take a CSV export of your event log from a Windows machine, and give you a per-user breakdown of print jobs and pages printed, by date.
[sourcecode language='php'] #!/usr/bin/perl $date = $ARGV[0]; $file = $ARGV[1]; $totalpages = 0; @uniq = (); %seen = (); %pgs = (); open(SRC, "<$file") or die("User Error: $!\n"); while () { @line = split(',',$_); if (($line[0] eq $date) and ($line[5] == 10)) { @pages = split('pages printed: ', $_); # 3 chops to remove CR, LF, and DQ chop($pages[1]); chop($pages[1]); chop($pages[1]); $totalpages = $totalpages + $pages[1]; push(@uniq, $line[6]) unless $seen{$line[6]}++; push(@uniq, $line[6]) unless $pgs{$line[6]}+=$pages[1]; } } close(SRC); print "Total pages printed: $totalpages\n"; foreach $k (sort keys %seen) { print "$k: $seen{$k} jobs, $pgs{$k} pages\n"; } [/sourcecode]
Run the script as follows:
perl printaudit.pl 12/04/08 eventlog.csv