383

I'm trying to set up an application from a third party, which requires a supporting website hosted in my local IIS. I've created a website exactly as explained in their install guide, but am having some problems, and would like to see what the IIS log has to say. Embarrassingly enough, the problem is I can't find the log files!

So my question is: Where does IIS7 store logs by default?

Promise Preston
  • 24,334
  • 12
  • 145
  • 143
Kjartan
  • 18,591
  • 15
  • 71
  • 96

11 Answers11

555

I think the default place for access logs is

%SystemDrive%\inetpub\logs\LogFiles

Otherwise, check under IIS Manager, select the computer on the left pane, and in the middle pane, go under "Logging" in the IIS area. There you will se the default location for all sites (this is however overridable on all sites)

You could also look into

%SystemDrive%\Windows\System32\LogFiles\HTTPERR

Which will contain similar log files that only represents errors.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
jishi
  • 24,126
  • 6
  • 49
  • 75
  • 1
    Thanks, this seems logical, but the logs directory is empty. I probably need to turn on logging somehow, but I can't find anything about logging in the middle panel in IIS Manager. – Kjartan Jun 21 '11 at 14:04
  • 78
    If you don't find it, it isn't installed. You need to fire up `Programs and Features` then click on `Turn Windows features on or off` on the left side then select `Internet Information Services\World Wide Web Services\Health and Diagnostics\HTTP Logging` – jishi Jun 21 '11 at 14:14
  • You can check how it is configured on your computer this way: https://portal.smartertools.com/kb/a2487/where-are-my-iis-log-files-stored.aspx – mauryat Jul 31 '14 at 20:37
  • 4
    I believe the latter path (...\HTTPERR) is the place where log files generated by http.sys land by default, not log files from IIS itself. See: https://technet.microsoft.com/en-us/library/cc784703%28v=ws.10%29.aspx – Jon Schneider Jan 05 '16 at 22:07
  • Note that when you click "Logging" in IIS, have the site you're interested in selected... – JohnnyFun Mar 08 '17 at 11:34
  • 7
    This logs are useless if you are looking for error message. – Vasil Valchev Mar 26 '18 at 14:00
  • Note: `%SystemDrive%` is _usually_ `C:` – kevinarpe May 21 '21 at 11:06
117

I believe this is an easier way of knowing where your IIS logs are, rather than just assuming a default location:

Go to your IIS site, e.g. Default, click on it, and you should see "Logging" to the right if logging is enabled:

enter image description here

Open it and you should see the folder right there:

enter image description here

You are welcome!

Rafid
  • 18,991
  • 23
  • 72
  • 108
  • 10
    On IIS10 the 'Logging' feature requires that at least the `World Wide Web Services -> Health and Diagnostics -> HTTP Logging` windows feature is installed. Otherwise it will not show up. – Pasi Savolainen Oct 05 '17 at 13:12
  • Any what if the Logging icon doesn't appear? I can't find my log files locally - none of the paths seem to exist on my machine. – Andy Mar 27 '18 at 20:12
105

I'm adding this answer because after researching the web, I ended up at this answer but still didn't know which subfolder of the IIS logs folder to look in.

If your server has multiple websites, you will need to know the IIS ID for the site. An easy way to get this in IIS is to simply click on the Sites folder in the left panel. The ID for each site is shown in the right panel.

Once you know the ID, let's call it n, the corresponding logs are in the W3SVCn subfolder of the IIS logs folder. So, if your website ID is 4, say, and the IIS logs are in the default location, then the logs are in this folder:

%SystemDrive%\inetpub\logs\LogFiles\W3SVC4

Acknowlegements:

  • Answer by @jishi tells where the logs are by default.
  • Answer by @Rafid explains how to find actual location (maybe not default).
  • Answer by @Bergius gives a programmatic way to find the log folder location for a specific website, taking ID into account, without using IIS.
Joel Lee
  • 3,656
  • 1
  • 18
  • 21
  • 3
    I found the ID by clicking on advanced settings in the Actions Panel after selecting the site in the Connections panel. – Stagg Aug 15 '17 at 08:50
19

The 100% correct answer for the default location of the log files is...

%SystemDrive%\inetpub\logs\LogFiles

Yes you can enter this into the explorer address bar it'll work.

To be 100% sure, you need to look at the logging for the web site in IIS.

https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85

i.e.

  1. Open IIS Manager.
  2. Select the site or server in the Connections pane,
  3. Double-click Logging.
  4. The location of log files for the site can be found within the Directory field

EDIT: As pointed out by Andy in the comments below you need to ensure when installing IIS that you elected to enable HTTP logging, otherwise HTTP logging won't be available.

Enable HTTP Logging

Mick
  • 6,527
  • 4
  • 52
  • 67
12

A much easier way to do this is using PowerShell, like so:

Get-Website yoursite | % { Join-Path ($_.logFile.Directory -replace '%SystemDrive%', $env:SystemDrive) "W3SVC$($_.id)" }

or simply

Get-Website yoursite | % { $_.logFile.Directory, $_.id }

if you just need the info for yourself and don't mind parsing the result in your brain :).

For bonus points, append | ii to the first command to open in Explorer, or | gci to list the contents of the folder.

Bergius
  • 949
  • 6
  • 14
6

Try the Windows event log, there can be some useful information

Tomas Walek
  • 2,516
  • 2
  • 23
  • 37
  • 2
    The event log will probably have any page errors that occurs on the site. – jishi Jun 21 '11 at 13:53
  • 21
    Seems like a good idea, but there is a great deal of info here, and I can't seem to find anything relevant to IIS. Any pointer as to where in the Event Viewer to look, or how best to filter the information there? – Kjartan Jun 21 '11 at 14:15
  • 9
    -1, reason: this answer is too general. Please provide a detailed explanation where in the event log the information can be found, or how to filter for it, otherwise given the huge amount of logs in the logs in the event log its too difficult to find the relevant logs. – lanoxx Jul 13 '16 at 15:12
  • Found the cause of my issue (connection closed only on *.woff files) in Windows Logs > System (in my case a wrong SSL configuration) – the_nuts Aug 26 '19 at 13:40
4

Enabling Tracing may be a better alternative to the Windows Event Log. This gave me the information I needed to fix my own WebService.

Preston S
  • 2,751
  • 24
  • 37
3

I think the Default place for IIS logging is: c:\inetpub\wwwroot\log\w3svc

Kjartan
  • 18,591
  • 15
  • 71
  • 96
honey
  • 199
  • 8
1

I have found the IIS Log files at the following location.

C:\inetpub\logs\LogFiles\

which help to fix my issue.

Hiren Parghi
  • 1,795
  • 1
  • 21
  • 30
  • I have just provided the default path where IIS log files lie on the server. If you can read the question. It is "Where does IIS7 store logs by default?" :( – Hiren Parghi Jul 15 '19 at 12:47
0

C:\inetpub\logs\LogFiles

Check the identity of the site going to sites and advanced settings

chandra
  • 111
  • 1
  • 1
  • 8
0

The simplest answer is to query like this:

(Get-Website * | % { $_.logFile.Directory});ls $GetIISLogs\W3SVC1\*

If you have more than one site you will get more than one answer, so you need to query with a 'foreach' to get the website name with the directory...

Patrick Burwell
  • 129
  • 1
  • 12