Sunday, August 6, 2023

Issue with Sitecore CleanUpAgent resulting in low disk space on Sitecore servers

Issue with Sitecore CleanupAgent resulting in low disk space on Sitecore servers

This blog is intended to demo the resolution of the issue with Cleanup Agent, due to which the old log files are not cleaned up automatically by the agent, resulting in low disk space on the Sitecore servers. 

In multiple versions of Sitecore, there is a bug in the CleanupAgent that the task executes but leaves behind so many log files. Usually, due to the rollingStyle mentioned in the Log Appender, for every 10MB, it creates log files with name ending with a suffix number like azure.log.xxxx.txt.1, azure.log.xxxx.txt.2 and so on.

Due to this bug

  • Low disk space on the Sitecore servers
  • Size of the app becomes quite huge
  • Backups will start to fail, and restore of the sites start to fail due to enormous back up size


With an easy fix, this issue can be resolved. With the below pattern, CleanupAgent will definitely pickup the log files ending with the number suffix and the logs folder will reduce to the expected size. 

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/"
   xmlns:env="http://www.sitecore.net/xmlconfig/env" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<scheduling>
<agent type="Sitecore.Tasks.CleanupAgent">
<files>
<remove folder="$(dataFolder)/logs" set:pattern="*log.*.txt*" />
</files>
</agent>
</scheduling>
</sitecore>
</configuration>

No comments:

Post a Comment