in reply to greping DB ERROR

I think you're only reading one line at a time from the file when you want to be reading multiple lines. Is there a delimiter between entries in your error log?