Event logs not cleared automatically

Srikanth N asked on September 12, 2019 16:27

Hi, In my Kentico 10 website the old logs are not deleted by default. I have a limited the logs to 2000 only in settings. We are having only one site so this is the only one value we have. As of now we are having around 38k logs in DB. Why Kentico not deleting 10% of old logs? Is there any scheduled task is present to do that work? I have the timeout setting as 240 in my connection string.

Recent Answers

Brenden Kehren answered on September 12, 2019 16:36

There must have been some issue where it wasn't cleaning up the logs previously and now it can't clean them up because there are too many in the table. You should be able to go into the database and write a query to clean up the log files older than say 30 days. The process should then pick up again and start cleaning them up automatically.

0 votesVote for this answer Mark as a Correct answer

Srikanth N answered on September 12, 2019 17:32

Thanks Brenden for quickest response.

In my local environment, i tested this scenario by inserting dummy items to event log. After i insert around 1800 records to "CMS_EventLog" table, the stored procedure was triggered like this. exec Proc_CMS_EventLog_DeleteOlderLogs @LogMaxSize=2000,@SiteId=0,@MaxToDelete=50000

I don't know why it is sending @SiteId as zero(0). Because of this no records are deleted. I have siteId as 5 in "CMS_site" table and that is the only records in "CMS_Site" table.

When i query "CMS_EvenLog" table with SiteId = 5 i got around 2900 records. I think some of these records has to be deleted right?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.