Get Error Details based on Correlation ID from ULS Logs in SharePoint 2013 using PowerShell

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can retrieve error details based on Correlation ID from ULS Logs in SharePoint 2013 using PowerShell. This command will be very much helpful, if you are working with multiple servers which are load balanced. Usually logs file will be too big and to get log details for a particular Correlation ID is difficult for multiple servers.

You my like to read:
– Convert field value to upper case or lower case in InfoPath in SharePoint 2013

– Get logged in username using SharePoint 2013 client object model

– Change SharePoint list Settings using PowerShell

Below is the PowerShell commnd which will pick the error details for the particular Correlation ID from all the servers to a single place.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

Merge-SPLogFile -Path “E:\Bijay\TempError.txt” -Correlation ff3a479d-8e3b-a03f-6251-ce47ef2463c6 -Overwrite

Make sure you have write access to the E:\Bijay\ folder.

Once you run the command, it will pull the logs from all the servers and it will write in the txt file.

Similarly also you can use get-splogevent command to retrieve logs based on the correlation id.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

get-splogevent | ?{$_.Correlation -eq “3eb6479d-c31e-70c8-65fd-37f3a9241469”}

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

get-splogevent | ?{$_.Correlation -eq “3eb6479d-c31e-70c8-65fd-37f3a9241469”} | select Area, Category, Level, EventID, Message | Format-List

Get-SPLogEvent -StartTime YYYY-MM-DDTHH:mm:ss | ?{$_.Correlation -eq “3eb6479d-c31e-70c8-65fd-37f3a9241469”} | select Area, Category, Level, EventID, Message | Format-List

You can also use the below command if you are trying in your local system rather in load balancer servers.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”

get-splogevent | ?{$_.Correlation -eq “da80689d-e397-70c8-65fd-34a7bc8a5446”} | select Area, Category, Level, EventID,Message | Format-List > E:\errorlog.txt

Hope this will be helpful.

Similar SharePoint 2013 Tutorials

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply