BTemplates.com

About This Blog

Powered by Blogger.

Search This Blog

Friday, June 14, 2013

How to check ULS Logs by Correlation ID in SharePoint 2010 with PowerShell Command?


How to identify Web front end server by Correlation ID?
OR
How to check ULS logs by PowerShell command?
In SharePoint 2010 Microsoft added Correlation ID features.
Correlation ID: Whenever you receive any error in SharePoint 2010, it generates logs with a unique Correlation ID. Then we go in to Web front end server and find this error by Correlation ID. The main problems come when we have multiple Web Front End servers. Then we need to do quite big exercise to find the errors. The PowerShell provides us very robust command for check the ULS logs by Correlation ID.

You can run this command and get result in various forms.

For get result in command prompt.

Get-SPlogEvent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List

e.g: Get-SPlogEvent | ?{$_.Correlation -eq "4aee5136-8ae1-4a26-bbe4-cb50001bc113"} | select Area, Category, Level, EventID, Message | Format-List

For get result as log file or as text file.

Get-SPlogEvent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List > C:\Error.log

e.g.: Get-SPlogEvent | ?{$_.Correlation -eq "4aee5136-8ae1-4a26-bbe4-cb50001bc113"} | select Area, Category, Level, EventID, Message | Format-List > C:\Error.log

If you have any time slot then you can get faster result.


Get-SPLogEvent -StartTime YYYY-MM-DDTHH:mm:ss | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List > C:\SPError.log


The error report file would be similar to this below screen shot.

 


This command gives you big relief to finding the exact location of the error.



0 comments:

Post a Comment