Correlation IDs
Since the previous version of SharePoint,
Microsoft has introduced Correlation IDs GUIDs (Global Unique
Identifiers) that map an event in SharePoint with the error or warning
in the ULS log (see Figure 3).
Prior to SharePoint 2013, the administrator had to hunt and peck
through the log files looking for the event that caused the error.
Correlation IDs now allow a user experiencing a problem and an error
page to send the ID to the administrator to find more details about the
issue.
As well as using a text-editor-find action to
find errors in the ULS log files, SharePoint includes a very nice
PowerShell command to simplify finding the messages with a given
Correlation ID:
Get-SPLogEvent | ?{$_.Correlation -eq "<ID>"}
The Logging Database
The logging database in SharePoint provides
developers with a central data store to capture all events occurring in
the platform. Microsoft introduced the logging database both to provide
a transactional database of all events for easy query and to herd
developers away from executing custom queries directly against content
and configuration databases in the farm.
The logging database provides a central
location to query all events occurring in the farm, whereas ULS logs
only report information per the verbosity settings and spread across servers in the farm. The
following steps demonstrate how to configure the logging database for
your farm:
- Open Central Administration.
- Click the Monitoring heading link.
- Click the Configure Usage and Health Data Collection link.
- Figure 3 shows a page for configuring the health data collection events.
- Ensure that the topmost check box is checked to enable usage data collection.
- Select the events you wish SharePoint to capture.
Note In
the Usage Data Collection Settings section, notice that the location
defaults to the same folder as ULS logs; if you look into this folder
you should see usage files as well as the familiar log files.
- Check the box for the Health Data Collection setting to monitor SharePoint farm health, which is in addition to usage.
- Click the Health Logging Schedule link if you wish to change the
schedules that the health logging timer services run (several of them).
- SharePoint populates the logging database using the various usage files on each SharePoint server.
- A timer service collects data from these files and populates the database configured in the Logging Database Server section.
- Click the link to configure the schedule of the log collection timer service.
Allow the usage collection to run for a day or
two and interact with your farm to generate usage events. Next, I shall
show you the logging database, which in my farm is the ROBDEMO_UsageandHealth database.
- Open SQL Server Management Studio.
- Navigate to the logging database.
- If you expand the Tables node, you should see a large number of partitioned tables, which is not too helpful.
- Expand the Views node instead.
- You may execute SQL queries against the views.
- In Figure 4, I ran a select T-SQL statement over the dbo.FeatureUsage view.
The logging database also contains a
number of stored procedures that return tabular usage data. As you can
see, the logging database provides a nice collection of usage event
data that developers may query in custom controls, without having to
dip into the main farm content and configuration databases. The premise
here is that Microsoft optimizes the configuration and content
databases for SharePoint and does not guarantee consistency in the
schema between versions. The logging database is isolated from the
other farm databases and offers consistency, allowing developers the
confidence that their queries remain working with future upgrades of
the platform.