Send to Printer

logs

A brief look at the referrals

December 23, 2005 12:30:18.051

I grabbed last week's logs again in order to see where the referrals might be coming from - I don't provide counts on the server side, so I had to run some scripts to cut that stuff out. This is fairly procedural code, because it's just slapdash stuff in a workspace - but Smalltalk is good for that kind of thing, given the immediate response. After reading in all the log entries, I had to clean up the list - my log viewer does this, so I just stole code from there:

 
 
 
 

"take the logs and cut down to the real referers"      
cruft := #('.jpg' '.gif' '.js' '.png' '.swf' 'inc/' 'servlet/'
'css/' '.wmv').
cleans := refs entries reject: [:each | | val | val := cruft
detect: [:each1 | '*', each1, '*' match: each command] ifNone:
[nil]. val notNil].
cleans := cleans reject: [:each | | val | val := ReferralScanner
currentRejects detect: [: each1 | each1 match: each referer]
ifNone: [nil]. val notNil].


That yanks out all the image fetches, and css, etc, etc. Next, I ran through the entries to figure out what the top referers were:

 
 
 
 

"now that we have that, we can get some data"
dict := Dictionary new.
cleans do: [:each |
	| stream cmd total|
	stream := each command readStream.
	stream through: Character space.
	cmd := stream upTo: Character space.
	dict at: each referer ifAbsentPut: [cmd->0].
	total := (dict at: each referer) value + 1.
	dict at: each referer put: (cmd ->total)].
collection := OrderedCollection new.
dict keysAndValuesDo: [:key :value |
	value value > 20 ifTrue: [collection add: key->value]]


That creates a dictionary of associations, matching up the referers to the pages on my server (and the counts from that source). Finally, sorting it:

 
 
 
 

collection := collection asSortedCollection: [:a :b | a value
value > b value value]


Then it's just a small matter of pushing out an HTML table:

Count Referring Site Blog Page
514 http://martinfowler.com/bliki/HumaneInterface.html Blog Page
223 http://blo.gs/ping.php Blog Page
178 http://planet.smalltalk.org/ Blog Page
155 http://www.artima.com/buzz/index.jsp Blog Page
89 http://www.whysmalltalk.com/EZine/index.htm Blog Page
85 http://www.google.com/reader/lens/ Blog Page
69 http://www.smallthought.com/avi/?p=8 Blog Page
67 http://www.damninteresting.com/?p=168 Blog Page
64 http://farm.tucows.com/blog/_archives/2005/12/9/1443435.html Blog Page
51 http://www.cincom.com/global/eng/blogs/ Blog Page
50 http://en.wikipedia.org/wiki/OPML Blog Page
47 http://www.artima.com/buzz/index.jsp?start=15&thRange=15 Blog Page
44 http://www.smalltalk.org/main/ Blog Page
42 http://www.artima.com/buzz/community.jsp?forum=155 Blog Page
37 http://planet.lisp.org/ Blog Page
36 http://www.cafeaulait.org/ Blog Page
33 http://www.netvibes.com/ Blog Page
32 http://weblogs.java.net/blog/johnm/archive/2005/12/humane_interfac.html Blog Page
31 http://planet.debian.org/ Blog Page
31 http://reddit.com/new Blog Page
30 http://www.artima.com/buzz/index.jsp?start=30&thRange=15 Blog Page
24 http://planet.smalltalk.org/index.php?page=2&hours=48&cat=all Blog Page
24 http://smallthought.com/avi/ Blog Page
23 http://mywebpages.comcast.net/brazz/ Blog Page
22 http://tech.memeorandum.com/ Blog Page
22 http://c2.com/cgi/wiki?JohnVlissides Blog Page

More than one of those is actually from Martin Fowler's "Humane Interface" post - I had to intervene manually to clean that up. I also eliminated all the posts that got 20 or fewer referrals. That list also doesn't include the scads of search engine referrals, because they didn't tend to cluster over the week I looked at. Now that I have a script, I'll probably take a periodic look.

 Share Tweet This