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]
where,
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 - http://code2care.org/2015/an-unexpected-error-has-occurred


Comments:

  • 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!
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap