Posted 22 September 2014 12:00 AM by Ravikiran Gokaraju, Senior Sitecore Developer@ClearPeople
Monitoring Sitecore applications is an absolute necessity if we need to pro-actively deal with issues that occur on applications before the client reports them. Sitecore does log everything to log files using Log4Net, which is really useful for monitoring the application health. But the issue is we need to somehow automate the log files analysis to find the right information from the logs which are quite descriptive and provide a way to send alerts to the support team when it finds any errors. Also it should be easy to configure the tool so that it gets the exact information we would like to see.
The list tasks the monitoring tool should perform at a bare minimum to monitor the Sitecore applications are:
- Analyse the Sitecore logs to get the list of all log entries
- Group them based on the Log level
- Ability to only analyse the log files within a certain time range, as there might be several log files
- Ability to configure what log level to look for
For example, we should be able to configure the tool to get all the Errors that occurred within the last two hours and send alerts to a configurable list of persons.
The alerts could be just normal e-mail alerts (in case of intranets, these are not publically visible) or a web page highlighting the recent errors that occurred (we can then configure tools like PingDom, Periscope etc., to look for particular text on the Error page and send alerts).
This module enables the easy setup of a Sitecore scheduled task which will analyse the Sitecore log entries created during a time frame and sends an email with the log entries found with a specific log level to recipients. The time frame, log level, recipients are all configurable.
Follow these steps to setup the module:
- Download and Install the Sitecore package
- Rename the config file from "CP.Diagnostics.Sitecore.LogAnalyzerTask.config.example" to "CP.Diagnostics.Sitecore.LogAnalyzerTask.config".
- Update the config file with settings appropriate to your Sitecore instance (See comments in the config file for more detail)
- Restart the Sitecore application
I am still working on improving this module to add more functionality, to allow filtering the log entries based on a regular expression which might be helpful if you are looking for a specific entry and add an Error listing page which can be used by other web monitoring tools and for getting the required information from Sitecore logs easily.
I will keep you posted on any improvements for this module.