On a number of occasions, I've run across apache servers that get "clogged" serving requests for a poorly-written PHP page. Looking at the HTTP status page, all the servers are in the "W" state. And while sometimes it's possible to find the offending site using the logs and a bit of lucky guessing, on systems running a large number of websites, it's very nearly impossible to find the offending script using the logs.
So, is there a way to find out what request a given apache process is serving "right now"? I've looked in the /proc/ directory and not found anything useful. I would imagine strace could prove helpful, but only if you got to it BEFORE the request started.
By the way: I'm familiar with the "slowloris" DOS attack, and it's not what I'm talking about.