Delete debug logs in bulk

When your org accumulates too many debug logs, you need to delete some or all of your system logs and monitoring logs. You can use either the Developer Console’s Query Editor to find and delete the logs using Tooling API or use Data loader.

In this blog, we will discuss both.

using developer console
  1. Open the Developer Console
  2. Select the Query Editor tab near the bottom of the console page
  3. Select the Use Tooling API check box.
  4. Execute the query ‘select id from apexlog’.
  5. Query Results will list available rows to be deleted.
  6. Use the keys Shift and Arrow Down together to select all rows for deletion.
  7. Click Delete Row.
Using data loader
  • Open Data loader application.
  • Login to your Sandbox or Production.
  • Click on Export button to extract all debug log ids.
  • Select “Show all Salesforce objects” and type “ApexLog” in the search box
  • Select “Apex Debug” option and Select your folder to store the file and go to the next screen.
  • Select Id from the list of fields and it will auto generate “Select Id FROM ApexLog” query for you.
  • Click on finish to extract all the debug log Ids.
  • After extraction, we will move on to delete operation by clicking on ‘Delete’ option.
  • On the next screen, as we discussed before, you will need to select “Show all Salesforce objects” and type “ApexLog” in the search box.
  • Select “Apex Debug” option and also select the file you extracted before using Browse button and go to the next screen.
  • Using “Create or edit Map” button map the Id field and go the next screen and click on the Finish button.
  • This will delete your all the debug logs.