newbie alert (been awhile since I said that)...

Is there some way to programmatically know the directory where the log files for a site are located? I am trying to automate the creation of web stats from the log files.

Also, how do you setup/create a web application which all websites on the server can use. For example, navigating to www.domain1.com/sitestats and www.domain2.ca/sitestats will run the same code.