Thursday, May 16, 2013

Accessing the SharePoint 2010 logging database

As mentioned in the introduction, the SharePoint 2010 logging database is a major enhancement to monitoring, debugging, and protecting the health of the farm.
By default, the database is called WSS_Logging . This database should be the starting point for administrators to collect and analyze information.
In this recipe, we will access the database and run a view (that already is installed) against it.

Getting ready

You must have farm-level administrative permissions to the Central Administration site. You must have read and execute permissions as well to the WSS_Logging database in order to open and execute views.

How to do it...

  1. Open up SQL Server Management Studio.
  2. When asked for authentication, log in to the correct instance where SharePoint is running using your windows authentication credentials. If SQL authentication is the preferred method of connecting, use the appropriate User ID/Password.
  3. Navigate to the WSS_Logging database and click on the plus sign to expand it.
  4. Under the toolbar at the top, click on the New Query button.
  5. In the new query window, type in the following query: Select * from RequestUsage.
  6. Click Execute. Results are populated in the window pane below the query, as seen in the following screenshot:

How it works...

In the above recipe a view called RequestUsage was executed. This is an out of the box view that provides site usage information. It provides information such as the referring URL, the browser being used, the site ID, the web ID, the server URL, the request type, and when it was done.
The logging database contains, but is not limited to, the following information:
SharePoint 2010 Monitoring and Reporting
It is a place where information is aggregated from across the farm. For instance, all ULS logs, from every SharePoint server, are collected within this database.
There are 26 views installed by default. However, the purpose of this database is to give administrators and developers a place to log information based on processes. These are typically custom processes. Views can be created to meet an organization's needs.

There's more...

The location of the logging database is not a setting that can be done through the user interface in Central Administration. Because of all the data that is collected in this database, it can grow quite large. Additionally, as SharePoint-integrated applications are created, developers can utilize this database to communicate issues.
Therefore, due to size and usage, it is a wise idea to move the database to another physical location such as a dedicated disk. This can be done only via PowerShell, using the following command:
Set-SPUsageApplication -DatabaseServer -DatabaseName [-DatabaseUsername ] [-DatabasePassword ]

More info

The ULS logs are present on every WFE. It is important for an Administrator to know where to find these logs manually. They are located at the following location: \Common Files\Microsoft Shared\Web Server Extensions\14\Logs.

No comments:

Post a Comment