Forum Moderators: coopster

Message Too Old, No Replies

processing log files with php scripts

....having some problems....

         

Algebrator

1:08 am on Nov 17, 2004 (gmt 0)

10+ Year Member



I appologize if the better place to post this was a tracking and logging forum, but the topic is kind of half-split between the two forums.

I want to write a php script that will analyze my server logs and based on the contents create an html file.

I would like to access the log files by using something like:
$open = fopen("http://www.mydomain.com/logs/logxx.gz", "r");
The problem is that I don't know what is the absolute path to the file. In the ftp program I am using, the html files are in www/htdocs subdir. To get to logs I need to "back up" to www and then logs dir becomes visible (www/logs). My question is how does this map to the fopen directory in the scripting language, and do I need to set up any special permissions?

Slade

1:35 am on Nov 17, 2004 (gmt 0)

10+ Year Member



Set up a test file in your public www folder that just contains:

<?php phpinfo();?>

Run the page and search for SCRIPT_FILENAME. Next to it, you will see the full path to your php file.

You'll probably have to hardcode a new directory path, but you should be able to point it straight into the logs folder.

As for your gzip question, a quick search of G didn't reveal anything promising...

Algebrator

2:01 am on Nov 17, 2004 (gmt 0)

10+ Year Member



Thank you,
As far as GZ goes I just found out there is such a thing as gzopen (...). Lucky me!

mincklerstraat

8:22 am on Nov 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Logs tend to be pretty long, and analyzing them with PHP can be s - l - o - w. Before you put too much work into coding do a test run or two and see if the result time-wise is acceptable, and that whatever extra analyses you are wanting to do aren't likely to take up your (and your server processor's) time.