Sample Code/Templates
This simple and free PERL script (5Kb download) reads your Web search engine's log and produces a report listing your most popular search phrases in rank order. You will need to gain access to the log or a copy of it. Run this script with the log as your input, and the report will be your output. You may need to tweak the script a bit depending on the idosyncracies of your search engine's log format. A number of institutions have run this script as a low-overhead way to gain basic insight into search patterns. You might want to run the script periodically--say, once a month. With the help of your server administrator, you might be able to automate periodic running of this report.
We're also looking for versions of this script in other languages, such as Python, Ruby, and Visual Basic. If you'd like to code this script in another language and share it, we'll be more than happy to host it here and fully attribute your great work.
Comments
the loganalyzer script wouldn't run until i removed the "numerically" and "logdatewise" words after the sort keywords in lines 81 & 93.
otherwise perl would give an error message:
Undefined subroutine in sort at ./loganalyzer.pl line 81, line 7283.
Posted by: Jhauser | June 13, 2006 02:46 AM
$ ./loganalyzer.pl
Number of queries with n search terms:
Illegal division by zero at ./loganalyzer.pl line 87, line 1475.
Posted by: Tim Evans | October 5, 2006 10:48 AM