---
schema_version: "1"
id: 0d57beac612583531354f0710425c143656fde74f3245b0a7ad4901279e00b2b
title: Delete Debug Logs
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/code_debug_log_delete.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.code_debug_log_delete.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: dd1fa354b800b4679f06cb21866b73aed2aa29564d9e8435407bdc064c54da72
description: When your org accumulates too many debug logs, delete some or all of your system logs and monitoring logs. Use the Developer Console’s Query Editor to find and delete the logs using Tooling API.
products:
  - Salesforce Platform
release: "264"
---
# Delete Debug Logs

When your org accumulates too many debug logs, delete some or all of your system logs and monitoring logs. Use the Developer Console’s Query Editor to find and delete the logs using Tooling API.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic (<a href="https://help.salesforce.com/s/articleView?id=xcloud.overview_edition_lex_only.htm&amp;type=5&amp;language=en_US" target="_blank">not available in all orgs</a>) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <span id="code_debug_log_delete__Apex_Code_editions_text"><a name="code_debug_log_delete__Apex_Code_editions_text"></a><strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, <strong>Developer</strong>, and <strong>Database.com</strong> Editions</span></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d32532e80">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d32532e80 ">To view, retain, and delete debug logs:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d32532e80 ">View All Data</td>

          </tr>
        </tbody>
      </table>

1. Open Developer Console.
2. At the bottom of the console, select the **Query Editor** tab.
3. Select **Use Tooling API**.
4. Enter this SOQL query:
    
    ```sql
    SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog
    ```
5. Click **Execute**.
6. Select the logs you want to delete. To sort by a column, click its header. To select individual logs, press Ctrl (Windows or Linux) or Command (macOS). To select a block of logs, press Shift.
    
    `LogLength` shows the size of the log in bytes.
    
    For system logs, `Location` is `SystemLog`. System logs are generated as part of system log monitoring, such as while you use Developer Console, and are visible only to you.
    
    For monitoring logs, `Location` is `Monitoring`. Monitoring logs are generated when your org has active `CLASS_TRACING` or `USER_DEBUG` trace flags. These logs are visible to all your org’s admins.
    
    - Each debug log must be 20 MB or smaller. Debug logs that are larger than 20 MB are reduced in size by removing older log lines, such as log lines for earlier `System.debug` statements. The log lines can be removed from any location, not just the start of the debug log.
    - System debug logs are retained for 24 hours. Monitoring debug logs are retained for seven days.
    - If you generate more than 1,000 MB of debug logs in a 15-minute window, your trace flags are disabled. We send an email to the users who last modified the trace flags, informing them that they can re-enable the trace flag in 15 minutes.
        
        ![Warning](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_code-264-0-0-production-enus/789bc523-706b-4ae4-8fe9-be6322e38b6b/images/icon_warning.png)
        
        Warning If the debug log trace flag is enabled on a frequently accessed Apex class or for a user executing requests often, the request can result in failure, regardless of the time window and the size of the debug logs.
    - When your org accumulates more than 1,000 MB of debug logs, we prevent users in the org from adding or editing trace flags. To add or edit trace flags so that you can generate more logs after you reach the limit, delete some debug logs.
7. Click **Delete Row**.
8. To confirm the log deletion, click **Yes**.