Is there a way to turn on debugging if a fastcgi request failed?

I have lvs running a healthcheck every few seconds. Logging this for
lengthy periods of time under debugging would wind up filling my
disk…

Is there any way to catch a specific error and log that under debug?

I am getting what appears to be failures a few times a day sometimes
on a simple echo “hi”; type script which I use for my healthcheck (to
ensure PHP is processing)

I can’t figure out what the issue is, and nginx on notice is not
showing me anything. I’d love to capture debugging output but I don’t
know if I have enough disk space for thousands of requests until I
catch one “in the act”

Any ideas anyone?

ldirectord reports this:

LWP::UserAgent::request: Simple response: Internal Server Error

So it’s getting some sort of error but I don’t know anything about it.
I can try to at least extract the error code, maybe. But still don’t
know the origin of it and nginx debugging output is probably the next
step I need to look through with its verbosity…

Thanks