I went through this drill a while back. I found that the best solution was installing a custom apache log handler that sends logs to a database. It works great. Here is
to do it. It was easy enough to look at this script and then write my own. I don't fool with parsing that silly access log anymore. What a pain.