We have a Force.com Site set up that a 3rd party service hits every so often via a webhook. We've noticed that there is an error every so often, but the webhook fires frequently enough that it is hard to catch it within 20 debug logs (let alone remembered to reset the debug log for the site user). Is there a better way to try to capture the debug log automatically in this case? It doesn't sound like there is a way to force the debug logs to capture indefinitely, and I'm not entirely sure where the error ends up happening (could be bad parsing of a character in the request body, could be a DMLException, etc). In our case, the DML occurs in @future methods, but most of the parsing occurs when the endpoint is hit (APEX controller).
We put a google analytics event on the error page (exception) that's passing back the exception text and the retUrl as values.
It isn't a full debug trace, but it at least tells us how many we have, what types, and what pages cause it so we can start the hunt.