Tuesday, November 18, 2014

The Best Way To Get A Correlation ID Error Out of Your ULS Logs

One constant in the SharePoint world is that there are always multiple ways to do almost everything.  I can't recall the number of times I've heard someone in a meeting say "there's many ways we can skin that cat" when asked how to do something in SharePoint.  I'm not real well versed in cat skinning, but I get the point.

I work with clients and customers all over the world.  It's interesting to see all the different ways and free tools used to figure out what that pesky correlation ID that popped up is trying to tell us.  There are definitely a lot of ways to skin that particular cat.  The one I use unequivocally in every situation is merge-splogfile.  This is definitely not a brand new concept but it is new to most of the SharePoint professionals I speak with.  I'm not the first to blog about it but since it is still relatively unknown with those I speak with, and this blog has good viewership, I feel compelled to share.

When you run into a SharePoint page that errors and gives you a correlation ID, simply copy the ID to your clipboard, pop open a SharePoint Management Shell window and type in:

merge-splogfile -correlation pasteyourid -path filename.txt

Now, I like an organized server so all of my servers have an Errors folder created in the root of c where I can save these.  So my command looks like

 Once entered you will see the progress in the management shell window.

Most of the time just opening that text file in notepad is sufficient for seeing what happened.  If you need more detail you can open it in uls viewer or even excel.  Generally speaking I open the file in notepad, search for "unexpected" and can tell exactly what's wrong.

Not sold yet... if you are in a multi server farm, which WFE do you think recorded the error?  If you are opening the file with a uls viewer on a specific server, you basically have to guess unless you have something else in place.  The beauty of merge-splogfile is that you can run it from any server and it gathers data on that correlation ID from the entire farm.  That is a thing of beauty.

This command works on SharePoint 2010 and 2013.  For more information on merge-splogfile check out the msdn article here.

No comments: