kwizcom banner advertisement

Merge-SPLogFile: Merge SharePoint Log Files from Multiple Servers

Problem: In a multi-server SharePoint farm, if you need to trace an issue, you have to log-in and review the ULS logs on each server in the farm. This process could be tedious in multi-server farms since you're not sure on which server the error has occurred.
Merge-SPLogFile: Merge SharePoint Log Files from Multiple Servers

Solution: Use the Merge-SPLogFile PowerShell cmdlet.

The Merge-SPLogFile cmdlet will consolidate the logs from all servers in the SharePoint farm into a single log file. You can run it from any server and it gathers data from the entire farm - to find issues.

Here are some examples of Merge-SPLogFile:

Extract LOG from all SharePoint Servers matching correlation ID:
Merge-SPLogFile -path "D:\ErrorLog.txt" -Correlation "Your-error-correlation-id" 
Use the above cmdlet to fetch ULS log for given correlation ID from all SharePoint servers in a multi-server farm. Here "path" refers to the log file name you want to create. If it already exists, use "overwrite" switch. This cmdlet looks for logs within past 20 Minutes of time span.

Merge-SPLogFile -Path D:\ErrorLog.txt -StartTime "20/10/2014" -overwrite

We can use parameters such as StartTime and/or EndTime parameters to to specify the range of the log entries. There are other properties to help you narrow down the log search:
  • Area
  • Category
  • ContextFilter
  • Correlation
  • EndTime
  • EventID
  • Level
  • Message
  • Process
  • ThreadID
Tips: Use New-SPLogFile cmdlet to instruct SharePoint 2013 to start a new log file.

See the complete examples at Technet: Merge-SPLogFile Technet reference
Merge-SPLogFile: Merge SharePoint Log Files from Multiple Servers Merge-SPLogFile: Merge SharePoint Log Files from Multiple Servers Reviewed by Salaudeen Rajack on May 17, 2014 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.