Introduction

What are Audit Logs? Audit logs are a feature in Microsoft Dynamics 365 that allows you to track and record changes made to data in the system. Audit logs can display events applied to records, such as creation, update, deletion, assignment, sharing, etc.


Why might it be necessary to delete Audit Logs? Typically, audit logs can consume a significant amount of storage space. When a client is close to exceeding the storage subscription's limits, there is a risk of additional costs. Deleting old audits and removing audits from environments where it's unnecessary to track such changes can help improve storage capacity and reduce expenses.

What we can do with Audit Logs

•    Delete audits for a specific period.
•    Delete audits for a particular table.
•    Delete audits from sandbox, development, and staging environments.
•    Delete audits on records where process looping occurred.
•    Turn off auditing for specific tables.
•    Turn off auditing for particular fields.

What you will get

•    Space optimization
•    Costs optimization

Prerequisites

•    Can be applied to: Microsoft Dynamics 365 Business Application (Sales/Marketing/Field Service/Project Operations) or Microsoft PowerApps Model-Driven Apps.
•    Corresponding security role assigned to the user: System Administrator or System Customizer.

Step-by-step Microsoft Dynamics 365 Audit Logs Deletion

 

Deleting audits for a specific period or from a separate table

 

  1.    In the upper-right corner of the app, select Settings (⚙️) > Advanced Settings > Settings > Auditing.

How To Delete Audit Logs in Microsoft Dynamics 365 - Advanced Settings

How To Delete Audit Logs in Microsoft Dynamics 365 - Auditing

2.    Select "Audit Log Management" and then choose "View Audit Logs."

How To Delete Audit Logs in Microsoft Dynamics 365 - Audit Log Management

3.    Select the oldest audit log up to the selected date. You can also delete logs by table or all records on the corresponding environment.

How To Delete Audit Logs in Microsoft Dynamics 365 - Selecting Logs to delete

4.    Select "OK" to confirm.

 

Deleting audits for a specific record


This approach may not release much storage, but it is also possible and worth mentioning. However, there could be cases where a process has looped through certain records and generated many audit records for that record.
For this, you should open the 'Related' tab and then delete logs in 'Audit History'.

How To Delete Audit Logs in Microsoft Dynamics 365 - Audit History

How To Delete Audit Logs in Microsoft Dynamics 365 - Deleting audits for a specific record

 

How to disable audits on a specific table


Sometimes it is not necessary to monitor changes on all tables. We can disable this option on the relevant tables to reduce the generation of audit log records.

This task requires the System Administrator or System Customizer role or equivalent permissions.

1.    Sign in to Power Apps.
2.    Select the environment for which you want to disable auditing.
3.    Select a table (Dataverse > Tables). Select the Contact table.

How To Delete Audit Logs in Microsoft Dynamics 365 - disable audits on a specific table

4.    On the command bar, select Edit, and then choose Edit table properties. Expand the Advanced options and uncheck the "Audit changes to its data" checkbox. Finally, save your changes.

How To Delete Audit Logs in Microsoft Dynamics 365 - disable audits on a specific table

 

How to disable audit for separate fields


Please note that it doesn't make sense to do that if you have already turned off audits for the table. This settings option is stronger than the fields settings. If you have the table audits turned on and want to disable audits for specific fields within the table, please follow these steps:


1.    Repeat steps 1-3 from the previous block.
2.    Under Schema, select Columns.
3.    Select the column you want to disable for auditing (e.g., Mobile Phone).

How To Delete Audit Logs in Microsoft Dynamics 365 - disable audit for separate fields
How To Delete Audit Logs in Microsoft Dynamics 365 - disable audit for separate fields

4.    Uncheck the Enable auditing checkbox.

How To Delete Audit Logs in Microsoft Dynamics 365 - disable audit for separate fields

5.    Save your changes.

Conclusion

By implementing the best practices outlined in this guide, you can effectively manage your audit logs in Microsoft Dynamics 365, contributing to improved system performance, reduced costs, and better resource utilization.