0

As per my current search, Salesforce Setup Audit Logs are stored automatically & we can't add any records to it manually when any apex is run or page is viewed or any custom object is added, updated or deleted. Please inform if any workaround is possible.

So to achieve that we might need to add a new custom object which will store our audit logs. Please inform if anyone has any better approach.

If we need to use a custom object to add logs, we can setup triggers if any custom object is added or updated. But how can we log following?

  • If any user login or logout
  • If any community user login or logout from community
  • If any user view salesforce standard object list or details page
2

This is a good use case for using Event Monitoring functionality provided by Salesforce.

Refer Get Started with Event Monitoring

Event monitoring provides tracking for lots of types of events, including:

  • Logins
  • Logouts
  • URI (web clicks in Salesforce Classic)
  • Lightning (web clicks, performance, and errors in Lightning Experience and the - Salesforce mobile app)
  • Visualforce page loads
  • API calls
  • Apex executions
  • Report exports
| improve this answer | |
  • Salesforce retains only data of last 1 day, is it correct? If yes, then how to see/show previous logs before 1 day? – Shivangi Patel Sep 3 '18 at 12:05
  • No, Salesforce retains 30 days – Santanu Boral Sep 3 '18 at 12:47
  • Article says they can retain data for 30 days at an additional cost. Any idea how much? If I have created custom pages for custom object list & add/edit, will it track them as well? Since it only retains last 30 days data at an additional cost, isn't it would be easier & cheaper to create custom object & store unlimited data? – Shivangi Patel Sep 4 '18 at 5:13
1

What you're looking for is event monitoring. It can track most of the meta-events you're looking for. Note that logout events are unreliable, as a user can terminate their session without explicitly logging out by simply closing their browser.

| improve this answer | |
  • Article says they can retain data for 30 days at an additional cost. Any idea how much? If I have created custom pages for custom object list & add/edit, will it track them as well? Since it only retains last 30 days data at an additional cost, isn't it would be easier & cheaper to create custom object & store unlimited data? – Shivangi Patel Sep 12 '18 at 9:32
  • @ShivangiPatel Yes, if you built something custom, you'd get unlimited monitoring. Of course, it can't detect all possible situations, either, but the trade off is that you get unlimited storage, as you've observed. – sfdcfox Sep 12 '18 at 12:55

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.