The Event Log and Schedule History records all the activities that occur throughout the DNN environment. Without proper management, these logs can grow to be very large and affect performance. This article details on how to clear out the tables.
- Platform/Evoq 7.4 and above
- Access to the SQL Server or a SuperUser account
NOTE: A database backup should be performed before running the attached script. Additionally, it's advisable that this is done outside of business hours as the process could take some time to complete.
The DNN event log stores each exception and all other registered events in the database. There is a scheduler job that users should have enabled to ensure the table doesn't grow too large and cause performance issues. However, if the job is turned off or there were many events between executions of the scheduler, the cleanup job and even a manual deletion command might time out.
In this case, truncating the table is the only option, as it purges all rows from the database table efficiently and without logging. While it was quite easy to run this command before, in DNN 7.4.0 and up, the EventLog table was split into three tables which are linked by Foreign Key Constraints to implementing referential integrity. This prevents you from simply applying the Truncate Table action.
- Access the Settings > SQL Console or SQL Server Management Studio
- Execute the attached script
- Run the query: TRUNCATE TABLE ScheduleHistory
- Clear Cache
The logs should be completely cleared out.
To test that the logs have been cleared out by:
- Go to Manage > Admin Logs to see if the Event logs are empty.
- Go to Settings > Scheduler > History to see if the Schedule History is empty.