Merge-SPlogfile PowerShell - SharePoint Correlation ID error

Posted on : Fri, 2nd Oct 15 10:31 am (Updated on : Fri, 2nd Oct 15 10:31 am) UTC
Author : Code2care
100+ votes

Consider a multi-server SharePoint FARM where you come across an error and SharePoint provides you just a Correlation ID. It can get very tedious for the administrator to find the actual error, especially scanning the logs on all servers.
There is a much easier option available in PowerShell which will return logs for a particular Correlation ID from the entire FARM.

Merge-SPlogfile - PowerShell command

The "Merge-SPlogfile" command will search the error logs for the given correlation error ID from all the servers in FARM.
The output file can be generated in a desired format (log, xls, etc) and placed on any location on the server.

Merge-SPLogFile -Path [FILE PATH] -Correlation [CORRELATION GUID]

Merge-SPLogFile = PowerShell Command
Path = Location where output file is to be saved, along with File Name and extension
Correlation = The correlation id (GUID) of the error

Example -

Start SharePoint Management Shell (run as administrator) and execute below PowerShell command.

Merge-SPlogfile –Path C:\sp_error.xls –Correlation xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

This will generate a file named "sp_error.xls" at location C:\. The generated file will consist only errors related to the correlation id provided in the command.

If you want to understand how the correlation id is helpful in troubleshooting the error, read here -

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +