Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to troubleshoot some events in my logs and need to figure out what web application is associated to the GUID the logs reference.

Anyone know how I can generate the GUID for each of my web applications?

share|improve this question
    
You can simply generate a GUID at this address: createguid.com I don't know if this is what you want. –  Farrell Apr 24 '12 at 14:11
    
Which version of SharePoint, 2007 or 2010? –  Dave Wise Apr 24 '12 at 14:11
    
Sorry...version 2010 SharePoint environment –  Jacob A Apr 24 '12 at 14:15
    
Let me confirm if I have understood your question: you are asking if the web application identifier is related to the GUID you see in the log and how you can calculate such GUID? In that case, please read my answer below. Otherwise, could you please explain what you need to do in more detail? –  SPArchaeologist Apr 24 '12 at 14:49
add comment

3 Answers

up vote 4 down vote accepted

You can use following PowerShell command to know all your Web Application's GUIDs.

Get-SPWebApplication | Select DisplayName, Id

However, bear in mind that, the GUIDs for each item in ULS logs are unique (typically for one unit of operation - like one page request) and they do not correspond directly to GUIDs of web application, unless the log suggests so.

share|improve this answer
    
This was what i was looking for...I knew there was some powershell behind it but didn't know how to pipe the name of the application to it. Thanks! –  Jacob A Apr 24 '12 at 15:00
add comment

To generate a GUID (in Powershell) -

$fooGuid = [guid]::NewGuid()

Visual Studio also has the 'Create GUI' option under the Tools menu.

This Powershell command (mentioned by Ashish above) gives you the Web App name and its ID (GUID) -

$apps = Get-SPWebApplication | Select DisplayName, Id 

and to extend more to the above by using PowerShell with the ULS Log files (using the Get-SPLogLevel/Set-SPLogLevel cmdlets) - this post may be helpful - SharePoint 2010 Logging Improvements – Part 1

share|improve this answer
    
Thanks having the VB was a helpful addition to the information that Ashish provided! –  Jacob A Apr 24 '12 at 14:59
add comment

If you are talking about the "Correlation" column in the log file, that info isn't related to the web application in any way (or at last - not in any documented way that I know of, it may still be possible that the ID is somehow calculated using some info from the web application identity).

That said, the correlation identifier is simply a GUID that is automatically generated for every request that the SharePoint web server receives. This identifier is also persisted and used in any further communication between server that the request may generate. From an user point of view this means that it's possible to track down any log records that where generated by a single request. Probably you have already saw it, but whenever SharePoint shows an error page it includes a "correlation id". Simply copy that id, search it in the log file (or use a tool like SharePoint Uls Viewer) and you will be able to filter out the records that contain info about the offending request.

As a developer you can include the current correlation id in any message you may be generating (this can help you to find the info you need), but the only way to do so that I know of is to use an external reference.

Anyway, this blog post should provide further info: link


To elaborate some more: If you need to somehow include a web application identifier in your log messages, you will need to do this "by yourself" - SharePoint does not include this information by default. That would not be a problem if you are generating the log record (simple include a web app identifier in the log info, even the web application description would do), but could be a problem if you are tracking some ootb log error messages. In that case, my suggestion would be to resort to the correlation id that should be displayed in the UI or backtrack the error based on the execution time - either way it shouldn't be possible to associate the correlation id (or the event/thread identifiers) to a specifi web app.

share|improve this answer
    
Thanks! I do understand that the Correlation ID is not the GUID of the web application and am familar with it's uses in the ULS logs. –  Jacob A Apr 24 '12 at 14:58
    
see if the edited part fits your original intentions a little more. If that isn't the case, could you please expand your question to further explain your needs? I will try to update the answer at soon as I have the time. –  SPArchaeologist Apr 24 '12 at 15:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.