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.
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
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 - http://code2care.org/2015/an-unexpected-error-has-occurred
Code2care'smission 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.