The First Ever Sitecore Azure App
by Vicent Galiana, Senior Sitecore Developer@ClearPeople
This module integrates within the Sitecore Azure Module 2.0 User Interface, allowing users to access Sitecore logs and windows events stored on Azure Table storage from within Sitecore, and dynamically filter by date range, log level and type.
When you use the Module Sitecore Azure 2.0 to move your Sitecore web site to Azure, you lose the log files, and the old log viewer becomes useless. Now, the information is stored in the table WADLogstable, in the table storage. The idea behind this change is to be able to continue using your logs, even if the virtual machine supporting your application is replaced.
In order to review your logs, you can use a storage explorer such as “Azure storage explorer”, or the Azure Table Storage Driver of Linq Pad 4, etc. Due to the storage limitations, these applications are quite cumbersome when you’re trying to find a problem, as it is quite difficult to filter by a range of dates, and it’s not possible to do a wildcard search.
In order to make our lives a bit easier we’ve created the ClearPeople Azure Log Viewer module. This module integrates within the Sitecore Azure Module 2.0 UI, and gives us access to the logs and the windows events from within Sitecore, allowing us to execute server searches by a date range, log level and instance name and then filter the results dynamically as we type. And now we want to share it with you!
- This module has been built on top of Sitecore Azure Module 2.0, so it’s the only pre-requisite.
You can modify several settings of the module editing the file App_Config\Include\ClearPeople.Azure.config
Using the module
- ClearPeople.Azure.LogsViewer.MaxRowsPerRequest: This is the maximum number or records the application will request to the table storage. Usually, this is the maximum supported by the provider.
- ClearPeople.Azure.LogsViewer.LogsTableName: This is the name of the table used to storage the logs.
- ClearPeople.Azure.LogsViewer.WindowsEventsTableName: This is the name of the table used to storage the windows events.
- ClearPeople.Azure.LogsViewer.NumberofExtraPagesToCache: The application will download extra pages and store them in cache.
- ClearPeople.Azure.LogsViewer.DefaultHoursToGet: By default, the UI will get the logs from the last x hours.
- ClearPeople.Azure.LogsViewer.FullyCachedTableSummaryText: Text to show in the summary when we’ve downloaded all the records available.
- ClearPeople.Azure.LogsViewer.CachingRowsPendingTableSummaryText: Text to show in the summary when there are pending rows to download.
- ClearPeople.Azure.LogsViewer.StoageConnectionString: Connection string template.
- ClearPeople.Azure.LogsViewer.JQueryUIThemeUrl: URl of a jQueryUI theme.
- ClearPeople.Azure.LogsViewer.DialogWidth and ClearPeople.Azure.LogsViewer.DialogHeight: Dimensions of the dialog.
- ClearPeople.Azure.LogsViewer.BindGridOnLoad: Set this property to true to get logs when the application is opened. By default, the last two hours.
- ClearPeople.Azure.LogsViewer.NoRecordsFoundText: Text to show when the server can’t find any record for the selected filter.
- ClearPeople.Azure.LogsViewer.LoadingText: Text to show while the application is busy.
Open the Sitecore Azure module, and click on one of your farms. Two new options will appear at the bottom of the context menu.
Here you can choose to review Sitecore Logs or Windows events. Both options will open the same interface, with the proper filter applied.
Use the date time pickers to define / refine the search time parameters according to your specific query. For severity, choose a maximum log level if you don’t want to get everything; if you need to filter per VM, select one of the VM’s in the Instance drop down menu. Select the number of rows to display on each page then click “search”. After a few seconds your logs will be there.
When you want to search for a specific entry in the logs, click on “Filter current page”, and type into the new text box. The filter will be applied instantly to the current page.
You’ll find a pagination control at the bottom of the table and you may find that the number of pages could increase while you’re navigating through them. This is a Table storage limitation as you don’t know the final / exact number of records until you get the last one – there is no ‘last’ pagination feature.
Each different query will cache its own results, so if you navigate forward and backward through the pages, it won’t create new request to the storage server.
This is preliminary version that has been created for internal use and the IP belongs to ClearPeople. If you find any bugs (and you will), please help us to improve this tool by sending through your comments.
Don’t install it directly in a production server, test is first. It won’t damage your logs, but it will modify your settings and bin directory, so something could potentially go wrong.
Keep in mind that querying the table storage and downloading records has a cost.
Install the module at your own risk; we’re not responsible of any damage it could cause.
The source code is available on the Sitecore Marketplace.
Functionality to be added on future releases:
- Export logs to file.
- Identify rows by colour based on the log level.
If you have any other ideas about how to improve this app (or if you find any bugs), please feel free to send us your comments by filling in this form.