Merge-SPlogfile PowerShell - SharePoint Correlation ID error

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 the 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 the 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 -


  • Can I use this PowerShell command to get logs from SharePoint Online site collection?
    anon 19 Aug 2020 22:09:43 GMT
  • solution does not work. i use sharepoint online in office 365.
    anon 03 Feb 2020 06:34:11 GMT
  • Further comments disabled!
Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -