Newer Version Available

This content describes an older version of this product. View Latest

Delete Event Monitoring Data

You can delete event log files that contain a user’s log data. Deleting log files helps you comply with data protection and privacy regulations and controls the information that others can access. You can’t delete individual rows from event logs. Instead, you must delete the entire log file that contains the user activity.
To delete an event log file, enable deletion in Setup, create a permission set that includes the Delete Event Monitoring Records user permission, and assign this permission set to your users. (Alternatively, you can assign the user permission to a custom profile.) Then those users can query and delete the EventLogFile record by using Query and Delete resources in REST or delete() in SOAP.

You can’t delete individual rows from event logs. Because event logs are stored in blob format in the database, you must delete the entire log file that contains the user activity.

Note

  1. In Setup, in the Quick Find box, enter Event, and then select Event Monitoring Settings.
  2. Enable deletion of event monitoring data. This action is recorded in Setup Audit Trail.
    Event Monitoring Settings page showing Delete Event Monitoring data option enabled
    The Delete Event Monitoring Records user permission is now available to assign to a permission set. (Alternatively, you can assign the user permission to a custom profile.)
  3. In Setup, in the Quick Find box, enter Permission, and then select Permission Sets.
  4. Create a permission set that includes the Delete Event Monitoring Records user permission, and save the permission set.
  5. In Setup, in the Quick Find box, enter users, and then select Users.
  6. Select the user you want to grant permission to delete event monitoring data.
  7. In the Permission Set Assignment section for this user, assign the permission set, and click Save. This action is recorded in Setup Audit Trail.
    Users assigned this permission set (or any custom profile that includes the Delete Event Monitoring Records user permission) can now delete event monitoring data. The next steps show you how to use the API to delete the data.
  8. To locate the logs containing the user activity that you want to delete, query the EventLogFile object. For details, see Query Event Monitoring Data with REST.
  9. Note the IDs of the returned logs.
  10. Use the sObject Rows resource to delete records. Specify the record ID, and use the DELETE method. For more information, see Delete a Record. Or, you can use Workbench to delete blob format data for event monitoring. In the Execute text box, use a DELETE request similar to /services/data/v52.0/sobjects/EventLogFile/0ATD000000000pyOAA.