Bookmarklets Home | Links | Forms | Text and Data | Zap | Web Development | Validation | Misc

My log parser

This is a lame log parser written in DOS/Windows batch format.

REM Make sure we're using cygwin's case-sensitive sort, not Windows's case-insensitive sort.
path=c:\cygwin\bin

REM Merge however many days of logs into one file.
cat acc* >all.txt

REM Create refer.txt.  (This all goes on one line.)
cut -d" " -f11 all.txt
 | grep -v "http:\/\/www\.squarefree.com" | grep -v "http:\/\/squarefree.com"
 | sort | uniq -c
 | sort >refer.txt

End of sample output (tail --lines=5 refer.txt)

      5	"http://ask.slashdot.org/article.pl?sid=03/04/26/007214&mode=nested&tid=95"
      5	"http://www.google.com/search?q=Bookmarklets"
      6	"http://daniel.glazman.free.fr/weblog/"
     15	"http://www.cexx.org/gator.htm"
    502	"-"
Then I use linkify to make the URLs clickable and colored according to whether I've visited them, and I use query as link text to make search referers easier to read. I open links from the logs in new tabs so I don't have to use those bookmarklets again after clicking Back. Then I use find links to squarefree on each referring page to the anchor text and context of the link. (You can customize the last bookmarklet to find links to your site at the Log Analysis Bookmarklets page.)

© 2000-2007 Jesse Ruderman (jruderman@gmail.com). Feedback is welcome.
Last modified April 28, 2003.