Parse & sort unique hits in logfiles

Updated . Posted . Visible to the public.

If you want to know the exact hits on your website (or whatever logfile you want) for a specific date without duplicates, here's how.
"Unique" means you don't want to count hits to an URL originating from the same IP twice.

You can use the attached script to do so:

# ./log_parser.rb 2011-10-04

27 hits on /rss.xml
36 hits on /stylesheets/fonts/slkscr-webfont.woff
37 hits on /stylesheets/fonts/slkscrb-webfont.woff
37 hits on /images/bullet.png
38 hits on /images/download.png
38 hits on /images/play.png
39 hits on /stylesheets/gameboy.css
39 hits on /stylesheets/screen.css
39 hits on /javascripts/jquery-1.6.1.min.js
43 hits on /images/hosts/x2/arne.png
43 hits on /images/hosts/x2/thomas.png
43 hits on /images/hosts/x2/henning.png
45 hits on /
46 hits on /images/die-nerdtanke-75x75.png
50 hits on /favicon.ico
260 hits on /podcasts/nerdtanke-8.mp3
Thomas Eisenbarth
Last edit
Attachments
Keywords
apache, access, log, parse, unique, ip, url
License
Source code in this card is licensed under the MIT License.
Posted by Thomas Eisenbarth to makandra dev (2011-10-21 12:58)