Thursday, October 31, 2013

How to easily collect verbose ULS logs from a scaled out SharePoint farm using powershell

One of the more difficult aspects of troubleshooting a large SharePoint farm is looking through a multitude of logs from multiple servers.  One of the environments I support has twelve servers in the farm.  So it becomes very tedious when I have a complex issue that I need to reproduce with verbose logging enabled.

Here are some powershell commands to quickly help you turn on verbose logging and aggrigate all of the logs from all of the servers (for a specific time span) into one file for review.

Powershell command to turn on full verbose logging.

Set-SPLogLevel -TraceSeverity VerboseEx

Reproduce the issue you are having...

Powershell command to turn off verbose logging.

Powershell command to aggrigate the logs from all servers in the farm.
Merge-SPLogfile -path c:\mergedULS.log -starttime <"mm/dd/yyyy hh:mm"> -endtime <"mm/dd/yyyy hh:mm">

After performing the steps above you will have a single log file that you can analyze in a log viewer tool (such as ULSViewer) to help you more efficiently identify your issue.

No comments:

Post a Comment