03 February 2016

SharePoint 2013 - Find ULS logs with Correlation Id

Generally whenever we get any SharePoint error, it is accompanied by a Correlation Id which is essentially a GUID. This can be searched in SharePoint ULS logs to find the actual error details.

Searching ULS logs for a particular correlation id is not easy due to following reasons -

  • ULS logs are text file. Searching and copying errors for a particular correlation id is effort and time consuming.
  • ULS log file tends to get large, sometimes more than 250MB. Opening and searching such huge files is not easy for any text editor or even ULS Viewer.
Recently, one of my team-mates told me an easy way out. Just run following command in SharePoint PowerShell and pass correlation id as input. It will copy all the logs related to that correlation id in a separate text file which you can easily view using any text editor or ULS Viewer.


get-splogevent | ?{$_.Correlation -eq "<correlation-id>"} | select Area, Category, Level, EventID, Message | Format-List > C:\TraceLog.log

C:\TraceLog.log is the location where your ULS logs related to that correlation id will be copied. You can specify any location and file name of your choice.




No comments: