Can you please tell me, if there is a way to check @RestResource usage frequency?

Short summary: I have a legacy @RestResource which is supposedly not used by anyone. I want to check that.

I have several ideas about it, but maybe there is a better way.

  • Create Custom Object Log__c and insert a record every time @RestResource is called.
  • Check debug logs with SOQL SELECT Id, Operation, SystemModstamp FROM ApexLog WHERE Operation LIKE '/resource%', but I can retrieve only tiny time range.

Any thoughts would be appreciated!

  • 2
    In general logger for API would be a good idea.
    – Raul
    Jul 22, 2021 at 8:49
  • 1
    we export our Shield EventLog files to our company's Sumo Logic which has a built in collector for SFDC events
    – cropredy
    Jul 22, 2021 at 22:54

1 Answer 1


As noted in this question, Apex execution isn't logged outside of the EventLogFile object, which is not available via Workbench and accessing the logs for Apex execution appears to be part of a paid add-on with a 30 day retention window (the free version is limited to "insecure external assets, login, logout, and total API usage event log files with 1-day data retention"). Since this would count as Apex execution - and I haven't found any documentation regarding tracking usage of REST endpoints specifically - unless you have this paid feature already and are fine with the 30-day window, I'd agree with Raul; using a custom log object is probably your best bet.

  • 1
    I have already implemented custom logging, but was hoping to use native SF mechanism. Anyway, it is useful to know about this feature. Jul 22, 2021 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.