How to query ApexLog raw body?
I need to find, in Apex Logs raw bodies, references to a given String value.
I know we can query the object Apex Log fields, by using the following code: SELECT id,
loguserid,
loglength,
lastmodifieddate,
request,
operation,
application,
status,
durationmilliseconds,
systemmodstamp,
starttime,
location
FROM apex log
And, once we have the log ID, we can either retrieve a raw log, using the REST resource /objects/Apex Log/id/Body/ or even the totally not recommended trace download:
https://YourPrefix.salesforce.com/apexdebug/traceDownload.apexp?id=99999999999999YourID
Now, is it possible to query Debug Logs Bodies, directly, using a WHERE clause, to find a string reference? In which object the debug body is stored?
It's in Apex Log, but you can't query/filter the log itself, only the exposed metadata (e.g. status or request). You would necessarily need to download each one using the preferred API (/objects/Apex Log/{id}/Body). This limitation exists because you can't filter on the logs. You also cannot search (SOSL) on Apex Log, either, probably as a matter of performance.