Track Sitecore Configuration File Changes

Greetings Readers,

This post applies to Sitecore Version 8.0 Update 3 (150427) and higher.

Did you ever feel a need to track your sitecore config changes ?

Did you want to know what were the configuration at a certain time ?

Did you want to know how your caches were performing or the rendering statistics at a certain time ?

If the answer is yes, then this post is for you, Sitecore out of the box from version 8.0 Update 3 has a Sitecore Configuration dumping feature which creates and dumps  a zip file of the configuration in your data folder.

Here is the processor which does the magic

 <!-- DUMP CONFIGURATION FILES
        Dumps the specified configuration files and allows you to monitor all the changes that are made to the configuration files.
          Supported child nodes:
            DumpFolder: The path to the root folder where the config file dump is stored. Each config file dump is stored in a folder or
                        a zip archive. The name of the folder or zip archive has the following format: {date}.{time}.
                        Default value: $(dataFolder)/diagnostics/configuration_history
            Zip:        Boolean value that determines whether each dump should be zipped. Default value: true
            files:      Contains <file> nodes where the "path" attribute value is the path to the configuration file or the folder that
                        should be dumped.
        -->
      <processor type="Sitecore.Pipelines.Loader.DumpConfigurationFiles, Sitecore.Kernel" patch:source="Sitecore.Diagnostics.config">
        <dumpFolder>$(dataFolder)/diagnostics/configuration_history</dumpFolder>
        <zip>true</zip>
        <files hint="raw:AddPath">
          <file path="/App_Config" />
          <file path="/Web.config" />
          <file path="/Global.asax" />
          <file path="/sitecore/shell/sitecore.version.xml" />
        </files>
      </processor>

The above processor is defined in the Sitecore.Diagnostics.config configuration include file and supports various configuration settings such as

  • Add custom files which needs to be tracked (This is great where you can track almost any file which you want)
  • Modify the location for storing configuration files (Default : $(dataFolder)/diagnostics/configuration_history)
  • Support for Zip compression

Note : Sitecore cleans up the above folder with items which are older than 30 days, you can increase of remove the automatic clean up from the Sitecore.Diagnostics.config file

  <scheduling>
      <agent type="Sitecore.Tasks.CleanupAgent">
        <files>
          <remove folder="$(dataFolder)/diagnostics/configuration_history" pattern="*" maxAge="30.00:00:00" recursive="false" />
          <remove folder="$(dataFolder)/diagnostics/health_monitor" pattern="*.*" maxAge="07.00:00:00" recursive="false" />
        </files>
      </agent>
    </scheduling>

Additionally Sitecore also does periodic dumping data from /sitecore/admin/stats.aspx and /sitecore/admin/cache.aspx pages to the file system The location and format of the log file can be configured as part of the processor configuration. By default, dump files are stored in /diagnostics/health_monitor in the Data folder.

  <healthMonitor>
        <!-- Dumps the information that the /sitecore/admin/cache.aspx page contains -->
        <processor type="Sitecore.Pipelines.HealthMonitor.HealthMonitor, Sitecore.Kernel" method="DumpAllCacheStatus">
          <dumpFile>$(dataFolder)/diagnostics/health_monitor/CacheStatus.{date}.{time}.html</dumpFile>
        </processor>
        <!-- Dumps the information that the /sitecore/admin/stats.aspx page contains -->
        <processor type="Sitecore.Pipelines.HealthMonitor.HealthMonitor, Sitecore.Kernel" method="DumpRenderingsStatistics">
          <dumpFile>$(dataFolder)/diagnostics/health_monitor/RenderingsStatistics.{date}.{time}.html</dumpFile>
        </processor>
      </healthMonitor>

This gives us a chance to travel back in time and look at our site configuration files, rendering statistics, cache status etc…

Here is a snapshot of the folder structure as the data is dumped

Configuration Files Dump
config

Cache and Stats Dump

cache

 

There you go, hopefully I gave us all developers one more reason to LOVE SITECORE….. 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: