I use this script on a daily basis, to let me know what pages and what searches are leading people into my TWiki instance. I'm not going to bother documenting this... it requires Perl skill to adjust, so you either have it or you don't. It can be configured to report links in from forums, as well as a number of different translation methods to parse the referrers from the various search engines.
In order to do anything useful with this script, you must use Apache's combined log format. You could perhaps use some custom formats which include the same information, but you'd have to either change the script a little or ensure that the first few fields all match up with the combined log format.
I'm sure this can be generalized, particularly if I set up some kind of fancy distributed server for parsing search engine referrals.
/bin/grep `/bin/date +%d/%b/%Y` /home/gunwiki/access_log | /home/gunwiki/bin/getsearchtarget.pl | /bin/mail -s "Gunwiki searches for `/bin/date +%D`" email@example.com
Usage: getsearchtarget.pl <access_log
- 15 Feb 2008