53

I have a server running multiple websites under IIS7.5. I want to view the log files for one website in particular. In C:\inetpub\logs\LogFiles I see a number of folders, W3SVC1 through 6.

How do I find out which website corresponds to which folder? In IIS6.0 it used to tell you, but I can't find this anywhere in IIS7.5.

3 Answers 3

60

The numbers on the folders correspond to the Site ID of each specific site in IIS. If you go into Internet Manager you can see the Site ID's by clicking on the Sites node in the navigation pane.

So, if a site has ID 1 its log folder name is W3SVC1, ID2 = W3SVC2, etc.

You could also review %WinDir%\System32\Inetsrv\Config\applicationHost.Config, which contains information about all of the sites. It is XML format. You'll want to look for <site> nodes in the XML which contain an id attribute. This is the aforementioned Site ID of that specific site and will align with the number in the log folder.

<site name="Default Web Site" id="1">
2
  • 12
    You can also run the following command. It will return the ID's of the sites: C:\Windows\System32\inetsrv>appcmd list site
    – debuke
    Commented May 6, 2013 at 15:53
  • 2
    And the Get-Website PowerShell command. Commented Dec 13, 2017 at 5:45
1

I used Powershell

Import-Module WebAdministration
$iisAppName = "MySite"
$site = Get-ItemProperty IIS:\Sites\$iisAppName
$site.id
0

Based on Robert Brookers answer I created the following powershell script to get a list of all sites logging folders:

# Import the WebAdministration module
Import-Module WebAdministration

# Get all websites on the local machine
$websites = Get-WebSite

foreach ($website in $websites) {
    # Get the site.id for the website
    $siteId = $website.id

    # Construct the W3SVC folder path for logging
    $w3svcLogPath = "C:\inetpub\logs\LogFiles\W3SVC$siteId"

    # Display the information
    Write-Host "Website: $($website.name)"
    Write-Host "Site ID: $siteId"
    Write-Host "W3SVC Log Folder Path: $w3svcLogPath"
    Write-Host "-------------------------"
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .