[plug] Making a PHP application's Apache logs meaningful
Matthew Lambie
mlambie at thefrontiergroup.com.au
Tue Aug 30 15:34:40 WST 2005
'Afternoon all,
Here's my dilema; I'm sure someone can point me towards a solution.
We have a client that has a web site. They run it on our server, and we
use AWStats to parse the Apache logs and give them pretty pictures to
look at. The logic behind the site is quite simple, an index.php takes a
variable of "c" in the form of "index.php?c=21" which translates to
"retrieve content page 21 from the database and display it in the
content area".
Each content page has a title, so page 21 might be "Magical Lifesaving
Product Extreme". When they look at their AWStats all they see is a hit
to index.php, and there's no reference to "c=21" (which is meaningless
anyways).
The number of hits to index.php (and hence the site) is irellevent. What
matters is that they need to look at their stats and see a hit to
"Magical Lifesaving Product Extreme". My first thought was to modify
their index.php handler to write a fake entry into their Apache log
file, so it would show a hit to "magical_lifesaving_product_extreme.php"
but it doesn't appear that I have write-access to the log files without
messing with their permissions, and then there's the headache of
breaking logrotate... and so on. That seems dead end.
The only guaranteed way I can think is to write a log to the database,
and have a cron job read the database and write the fake entries to
their log file. I'd rather avoid this.
Using a 404 handler with Apache's mod_rewrite might be an angle, but I
know nothing about this... which I why I'm putting the call out.
All of their "internal links" reference "index.php?c=21" so I can't
break that, but I could follow the thought process of "if c is an
integer, then look up the title of that page and request the browser to
request the title (magical_lifesaving_product_extreme.php)" which is
handled with mod_rewrite... maybe?
Sorry for the manuscript!
--
Thanks,
Matthew Lambie
Technical Director
THE FRONTIER GROUP, PTY. LTD.
Suite 17/44 Kings Park Road
West Perth, WA 6005
Australia
w: http://thefrontiergroup.com.au
e: mlambie at thefrontiergroup.com.au
f: +61 (08) 6263 4444
m: +61 408 866 997
More information about the plug
mailing list