I want to create a script that parses or makes sense of apache’s error log to see what the most recent error was. I was wondering if anyone out there has something that does this or has any ideas where to start?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a few things to consider first:
However, if none of these apply, you can use the normal file reading commands to do it. The easiest way to get the last error is
There’s probably a better way of doing this that doesn’t oink up memory, but I’ll leave that as an exercise for the reader.
One last comment: PHP also has an ini setting to redirect PHP errors to a log file:
error_log = /path/to/error.logYou can set this in httpd.conf or in an .htaccess file (if you have access to one) using the php_flag notation: