The error log can be defined in each virtual host, as well as globally, so assuming your script has read access of httpd.conf, you could parse that to find out the location of the log (then run 'tail -3 $log_location' or whatever').
Kickstart
Comment on Re: Reading the last fews lines of the Apache error log