Sunday, August 31, 2014

SharePoint 2010 Diagnostic and Usage Analysis Logs best practice

SharePoint 2010 has improved the way the ULS logs information and now these diagnostic logging data can be written to trace files, Windows Event Viewer and a new SharePoint reporting database (new in SharePoint 2010). Trace log files are created in a Log folder under the root folder where SharePoint has been installed by default; that is also called the 14 Hive.

SharePoint diagnostic logging is very important, and extremely helpful when we encounter problems with our SharePoint environment. However, diagnostic logging can be ineffective at times, and can even cause SharePoint performance to slow down if it’s not managed properly. The one thing you should ABSOLUTELY do is move the ULS logs off of the system drive. ULS is designed to stop logging if it percieves a disk space issue and moving the logs off of the system drive ensures that logging isn’t going to fill up the system drive, and that ULS logging isn’t going to contend with your page file for disk IO. Note that in order to change the location fo the log file, the path must exist on ALL SharePoint servers, and the folder’s permissions must be set to allow the SharePoint service to write to it.

There are two sets of logs you want to move in the SharePoint 2010 farm environment, the diagnostic logs and the usage logs.

Diagnostic logs: With Central Admin:

Central Admin > Monitoring > Configure Diagnostic Logging (/_admin/metrics.aspx). The setting is the “Trace Log” path at the bottom. It is recommended changing the Drive letter and leaving the rest of the path alone. It’ll make it easier for you to find things later on.

With PowerShell: You can also use PowerShell to change this. The cmdlet is Set-SPDiagnosticConfig and the parameter is –LogLocation.

Set-SPDiagnosticConfig -LogLocation “E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

Usage logs: With Central Admin:

Central Admin > Monitoring > Configure web analytics and health data collection (/_admin/LogUsage.aspx). The setting is the “Log file location” setting. Set it to the same path you did the Trace Log above.

With PowerShell:

The PowerShell cmdlet to alter this is Set-SPUsageService and the parameter is –UsageLogLocation. Set-SPUsageService -UsageLogLocation “E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\”

No comments:

Post a Comment