Apache log munging
Joe Python
jopython at gmail.com
Wed Oct 8 13:55:42 EDT 2008
I have a written a generator for an apache log which returns two types of
information,
hostname and the filename requested.
The 'log' generator can be 'consumed' like this:
for r in log:
print r['host'], r['filename']
I want to find the top '100' hosts (sorted in descending order of total
requests) like follows:
host filename1 filename2 filename3 .... Total
hostA 6 9 45 110
hostC 4 43 43 98
hostB 34 4 45 83
and so on.
Is there a fast way to this without scanning the log file many times?
Thanks in advance.
- Jo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081008/1256ede9/attachment-0001.html>
More information about the Python-list
mailing list