Logging is a crucial aspect of maintaining a Sitecore system, as it helps identify issues and resolve them.
Sitecore uses log4net settings to manage the logs in the CMS and frontend website, and tracks DEBUG, ERROR, INFO, and WARN level errors.
The logs are typically stored in the App_Data\logs folder, and Sitecore provides a clean-up agent to remove old logs and free up disk space.
Please refer the below given clean-up agent settings which Sitecore has provided by default:
However, when hosting Sitecore in Azure, the log files may have a different naming convention, such as azure..txt. Additionally, if Sitecore creates a file with a number appended to the end, such as log txt.number, the default clean-up agent may not remove it because the pattern does not include the number suffix.
Please refer below solution to clean up the azure logs in your instance:
For removing all logs file, you have to update the above configuration with below settings:
To solve this issue, a patch file can be created to update the clean-up agent settings.
For Azure, a new agent has been added specifically to clean up the Sitecore Azure log files, as the default settings do not clear them.
The maxAge value can also be updated to retain only the last 7 days of logs, to avoid disk space and backup issues in the Azure environment.
By following the above given steps and points, you can solve the Sitecore Azure log clean up issue.