© copyright 18.Mar.2009 by Paul Bradley filed under MySQL
Like most people I use Google Analytics to get statistics about my sites visitors, but I also use Analog to analyse my server log files. Analog was the first piece of software I used to analyse my sites traffic over nine years ago, and it's kind of hard to break the habit of using it, as it's so flexible and configurable. I configure it to give me a quick summary of the last three days worth of activity.
The articles on this site are held within a MySQL database; I basically have an articles table which has an auto incrementing id column, which becomes the URL for the article, with the help of a little Apache Mod Rewriting, and a title column, which naturally holds the title of the article.
Analog has a command which allows you to substitute the URL with the page title in it's reports. The syntax for the file alias command is :-
FILEALIAS /URL/ "Page Title"
The sample SQL below, is what I use to extract the ID number and Title from the database, and format it into a sequence of Analog FileAlias commands.
SELECT CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(
"FILEALIAS /", id),
"/")),
" ""),
title, """)
FROM articles;
I run this SQL statement from a PHP script, via a cron job nightly, to append these commands to my main Analog configuration file, so that I always have page titles within my reports.
About the Author
Paul Bradley is a VB.NET software developer living and working in Cumbria. He provides PHP & MySQL bespoke development services via his software development company, Carlisle Software Limited.
He has over 20 years programming experience.