3

I'm trying to figure out when the temp folder gets cleaned. Talking about this setting in Sitecore.Config:

  `<sc.variable name="tempFolder" value="/temp"/>`

From what I found, there is a CleanupAgent in Sitecore.config defined for clearing the diagnostics folder in temp. But I haven't found anything that clears other folders or files in the temp folder.

Conclusion: they don't get deleted?

Folder examples are: __UpgradeHistory, IconCache, Install

<!-- Agent to clean up work files -->
<agent type="Sitecore.Tasks.CleanupAgent" method="Run" interval="06:00: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="30.00:00:00"/>
    <remove folder="$(dataFolder)/viewstate" pattern="*.txt" maxAge="2.00:00:00" recursive="true"/>
    <remove folder="$(dataFolder)/Dashboard reports" pattern="*.*" 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"/>
  </files>
</agent>

Is there an overview of when what gets deleted/invalidated in the temp folder?

10

The folders you mention will not get cleared automatically.

Reason been that, for example __UpgradeHistory is created when you run an sitecore upgrade and it contains all the valuable information (results, errors, packages, etc) about upgrades. These information is useful when you try to debug upgrade issues (ex: sitecore support sometimes ask for these forlders when you raise an issue with upgrades)

If you want these folders to be cleaned, you have to delete them manually.

6

We've just run across a similar issue due to a large number/size of files in __UpgradeHistory folder on our CI servers which caused us to run out of space on the drive. At a certain point, we don't really care about old files - even if there issues, we only care about the latest ones since that has the potential to create rollback packages or would be the files requested by support.

We resolved the issue by adding a custom file location to the CleanupAgent and specifying a maxAge of 30 days:

<scheduling>
  <agent type="Sitecore.Tasks.CleanupAgent">
    <files>
      <remove folder="$(tempFolder)/__UpgradeHistory" pattern="*.*" maxAge="30.00:00:00" recursive="true" />
    </files>
  </agent>
</scheduling>

Add as many folder locations as required for your own requirements. Note that by default the agent is scheduled to run every 6 hours (not shown in the patch above).

It's also worth looking at the comments in the Sitecore config:

<!--
  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?      
-->

It's possible to use a rolling strategy to only keep the latest X files/folders. You should set rolling=true and the strategy as a comma separate list of values, e.g. stategy="2,2,2,2,2", each value representing the number of files to keep for hour, day, week, month, year.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.