How to automatically clean up Commerce Engine log files?

Grace: 2 weeks ago

Today we had a server go down because Commerce Engine filled up the disk space with log files. How can we configure it to automatically delete older log files? We're on Sitecore Commerce 8.2.1.

Hunter: 2 weeks ago

Sitecore Commerce uses Serilog for logging. The max log file count is controlled by the retainedFileCountLimit parameter which is set to 31 by default (Serilog.Sinks.File.dll --> FileLoggerConfigurationExtensions).

  • Files older than 31 days will automatically be deleted (

  • You can control the total size of the logs by limiting the maximum file size per log file by changing the FileSizeLimitBytes value in \wwwroot\config.json (default is 100 MB):

enter image description here