Wednesday, May 18, 2016

How to export the ULS log based on Correlation Id?

Scenario:
Sometime we may need to export check the actual error for the Correlation Id which we got in the browser. At that time, we can use the PowerShell command to get all the error details from ULS log which are related to the specific correlation id.


How:
Run the below command in the "PowerShell for SharePoint" window (Run as Administrator".


merge-splogfile -correlation "<Correlation Id>" -path .\desktop\<filename>.csv -starttime "<Time in server time format>" -endtime "<Time in server time format>"


Example:
merge-splogfile -correlation "e2677d9d-eedf-501a-7c9b-a41fc989149d" -path .\desktop\filename5.csv -starttime "5/18/2016 10:43:00 AM" -endtime "5/18/2016 10:45:00 AM"