I have an annoying problem that I'd like to solve using PHP unless there's a better way. I have a few small sites and I like to look at their logs every few days. Because of the size the logs don't increase in size very quickly. My web host compresses and rotates the logs when they get to 10mb which doesn't happen very often. So when the logs get bigger I have to download the same stuff every time just to get the last few days entries. I could delete the logs myself but I'm worried that'll break something. What I'd like to do is write a PHP script that parses the log file, and outputs all the entries after a certain date to another file, which is then emailed to myself using sendmail.
If I run this script using a web page that I login to I am assuming that my script will be able to access the /log directory from the /web directory (where all the actual web site files are kept). Unfortunately as this runs on a virtual host I have limited control over setup but I can CHMOD directories if required, although I have no access to Apache configuration files.
Is this a good way to do it or is there a better way? I know some basic PHP but the host also supports CGI and Perl. Thanks in advance!