Search this site


Metadata

Articles

Projects

Presentations

boredom + apache

Here's a silly oneliner that'll attempt to calculate per-file usage from an apache log.

awk '{print $7}' - | perl -e 'while (<>) { chomp; s!^/([^/]+)!/.html_pages!; 
$u = $1; next if ($u !~ s/^~//); @a = getpwuid(getpwnam($u)); $_ = $a[7] . $_;
$f{$_} += (stat($_))[7] }; map { print $f{$_} . " $_\n" if ($f{$_}) } keys(%f)'

Reads the log data from stdin. Output is unsorted. I'd make it smaller but I'm lazy and tired.