BeyondERP.Newsletter
Menu

Job page · System administration

Database log cleanup

A periodic job that deletes database log entries for chosen tables, log types or creation dates and times.

Business process
Administer system features
Menu item
action:SysDatabaseLogCleanUp
Setup steps
1 on this page
Show what matters for
PAGE GUIDEWhat the page does and how to use it8 sections. Choose a role to highlight what matters to you.
Everyone

1What it is and why

What it isA periodic job that deletes database log entries for chosen tables, log types or creation dates and times.
What you do hereUse this task to delete database log entries that you no longer need, choosing them by table, log type or creation date and time. Entries that are electronically signed can't be deleted.
ExampleFor example, BEAT's auditors agree to keep two years of database log; a cleanup job in each company deletes entries whose Created date and time is older than that, and electronically signed entries stay.
Database log cleanup page in Dynamics 365
The page in Dynamics 365. page title tab to open what to set or check
Functional consultant · Solution architect

2Where it fits

Business processAdminister system features
Menu pathSystem administration › Periodic tasks › Database › Database log cleanup
Set up firstDatabase log setup Microsoft Learn
Used next byDatabase Log (check the result) Microsoft Learn
Related pagesBatch jobs (cleanup runs per company) Microsoft Learn
End user · Functional consultant

3How to do it

About the examples: Examples and screenshots in this guide use BEAT, a demo company in a Dynamics 365 test environment. Use your own company's codes and values instead of copying them.

When to run it

When to run itWhen the database log grows past your retention plan, or when the change history of some tables is no longer needed for audit.
How oftenOn a schedule that follows your retention plan for logged data.
Batch settingsSchedule it in the background outside business hours, one job per company.
What the output showsDatabase log entries that match the table, log type or creation date you chose are deleted. Entries that remain within that selection are usually electronically signed, which can't be deleted.

Source: Microsoft Learn

Setup steps on this page

Schedule the database log cleanup

Delete database log entries past the retention period agreed with the auditors.

Steps from Microsoft

  1. Go to System administration > Periodic tasks > Database > Database log cleanup. The Clean up log dialog opens.
  2. On Records to include, choose the entries to delete: by Reference table ID, by Log type, or by Created date and time; select Filter for other criteria.
  3. Enter the value for that choice, for example the tables whose change history you no longer need to keep.
  4. On Run in the background, set when and how often the cleanup runs.
  5. Set up one cleanup job in each company, because the cleanup works per company.
  6. Afterwards, open System administration > Inquiries > Database > Database Log and confirm the chosen entries are gone; electronically signed entries always stay.

Source: Microsoft Learn

Fields on the page

FieldWhat it meansExample
Reference table IDDeletes log entries of this table only.Microsoft Learn
Log typeDeletes one type of log entry, such as insert, update, delete or rename key.Microsoft Learn
Created date and timeDeletes entries created in this range, for example older than your retention plan.Microsoft Learn Older than two years
Run in the backgroundSchedule the cleanup per company, outside business hours.Microsoft Learn

Common errors and fixes

MessageWhat to do
Some entries in the selected range are still thereThey are electronically signed; signed entries can't be deleted from the log. Microsoft Learn
Log entries of another company were not deletedThe cleanup runs per company. Set up a job in each company that logs changes. Microsoft Learn

Test checklist

  1. The database log no longer shows entries in the cleaned range.
  2. Entries outside the range, and signed entries, are still there.
  3. A cleanup job exists for every company that logs changes.

Source: Microsoft Learn

Functional consultant

4Setup decisions

Setup stepRecommended value and whyDecision, common mistake and test
Schedule the database log cleanupOne recurring job per company that deletes entries older than the retention agreed with the auditorsLearn: create a plan for how long you retain logged data; the log table grows quickly, and a cleanup job must be set up per company.How long is the database log kept?Setting up one job in the default company and expecting it to clean every company's log.Test: Entries older than the retention are deleted per company

Feature management and licence

Licence or add-inOn this system the page opens for Information technology manager. No Feature management feature needs to be turned on for this page.

Microsoft Learn

Solution architect

5Design impact

Shared or per companyPer company: the database log table carries a company key, and Learn says to set up one cleanup job per company. Microsoft Learn
Can it be undoneNo: Deleted log entries can't be restored. Agree on the retention period with your auditors before you run it. Microsoft Learn
If you change it laterElectronically signed records can't be deleted, and a cleanup job must be set up for each company. Microsoft Learn
Technical architect

6Technical

Menu itemaction:SysDatabaseLogCleanUp Checked in Dynamics 365
Roles to set it up and use itTo use itInformation technology manager SysServerITManagerGive people one of these roles. On this system, 1 role can run this page.Checked in Dynamics 365
Developer

7Developer

Open it by URLhttps://<your-environment>/?mi=action:SysDatabaseLogCleanUp
Data migrationLoad order: Database log cleanup has no data entity in Data management, so it can't be loaded from a file or a configuration template. It is a periodic job; set it up again in each company of each environment.Checked in Dynamics 365
Everyone

8Sources