I want to create my default Sitecore logs after a specific interval of time without deleting the old ones after every 5 minutes , also whenever the limit exceeds to 10mb (default maximum file size) , then the previous file looks like this log.20190608.104524.txt.2 format , I don`t need 2 at the last, instead create a new file with a new timestamp after the limit is exceeded

<agent type="Sitecore.Tasks.CleanupAgent" method="Run" interval="0:05:00">
  <!-- Specifies files to be cleaned up.
          If rolling="true", [minCount] and [maxCount] will be ignored.
          [minAge] and [maxAge] must be specified as [days.]hh:mm:ss. The default value
          of [minAge] is 30 minutes.
          [strategy]: number of files within hour, day, week, month, year
          [recursive=true|false]: descend folders?
  <files hint="raw:AddCommand">
    <remove folder="$(dataFolder)/logs" pattern="*log.*.txt" maxAge="00.00:05:00" />
    <remove folder="$(dataFolder)/diagnostics" pattern="*.*" maxAge="30.00:00:00" recursive="true" />
    <remove folder="$(dataFolder)/viewstate" pattern="*.txt" maxAge="2.00:00:00" recursive="true" />
    <remove folder="$(tempFolder)/diagnostics" pattern="*.*" maxAge="00:10:00" recursive="true" />
    <remove folder="/App_Data/MediaCache" pattern="*.*" maxAge="90.00:00:00" recursive="true" />

changing the CleanupAgent and also the maxAge from default to custom values didn`t delete the previous logs instead it shows

ManagedPoolThread #5 13:01:35 INFO  File is being deleted by cleanup task: Filename: C:\Inetpub\wwwroot\sc910\Data\logs\Owin.log.20190613.125631.txt, file date: 6/13/2019 7:26:31 AM, age: 00:05:04.2187088 (min age: 00:30:00, max age: 00:05:00). Reason: File is older than max age 00:05:00

ManagedPoolThread #5 13:01:35 INFO File was skipped as it appears to be locked by another process.

  • Do you mean you want to change the LogFileAppender in the Sitecore.config ? – Jan Bluemink Jun 13 '19 at 8:01
  • Yes , Suppose i have a limit on the <maximumFileSize value="100KB" /> , before 100KB , the format of the file is like , log.20190613.133349.txt , and after 100KB , the file becomes log.20190613.133349.txt.2 , and a new file with log.20190613.133349.txt name starts writing the logs , so i want that whenever the file is exceeding its limits , a new file with a new timestamp is generated – Rohan Bhateja Jun 13 '19 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.