Web server IIS 10.0 (Internet Information Services) on Windows Server 2016, as in previous versions, supports storing of HTTP requests and error logs for the sites running on it. IIS log files allow you to simplify the debugging, troubleshooting and optimizing your web sites and applications.
You can configure logging both on Per-server or Per-site level. To configure IIS logging on server level, open Internet Information Services (IIS) Manager console, choose server name and select Logging option in the right pane.
Note. The Logging option will be available only if IIS: HTTP Logging feature is installed (Web Server -> Health and Diagnostics -> HTTP Logging).
Config, view and change IIS Log location
In this section, you can select several options:
Log File format
Four types of log format are supported:
- IIS — Microsoft IIS log file format. Fixed text ASCI. The fields are separated by commas;
- NCSA —– National Center for Supercomputing Applications log file format. Fixed text ASCI format. The fields are separated by spaces, and the time is recorded according to local time with an indication of the offset relative to the UTC;
- W3C — centralized W3C log file format. You can specify the fields that are logged. The fields are separated by spaces. UTC time is used;
- Custom — customer logging format.
If you select W3C file format you can switch from standard file logging format to Event Tracing for Windows (ETW). This is high-performance logging system (first introduced in Windows Vista). When it is used, IIS saves HTTP logs to a specific trace log via the Event Tracing for Windows (ETW) service. ETW does not replace a regular event log and usually serves for short-term diagnostics of applications or the system.
Tip. To view and analyze IIS logs in ETW logs, use the free Microsoft Message Analyzer tool.
Log File Directory
By default, the %SystemDrive%\inetpub\logs\LogFiles directory is used to store logs. Over time, IIS log files can take up a large amount of space on the system drive. Therefore, with a large number of requests to IIS sites, it is recommended to store the logs on a separate drive.
Log File Rollover
In the Log File Rollover section you can configure rules for creating new log files (hourly, daily, maximum log size, etc.)
For the convenience of analyzing log files, it is recommended to enable the option Use local time for file naming and rollover (in this case instead of Coordinated Universal Time (UTC), the local time of the server will be logged in the logs).
To view IIS logs, open the directory specified as the Log File Directory using File Explorer. Each folder contains the logs of a separate site. In our case, there is only one site on the IIS server, so there is only one log directory named W3SVC1.
Open this folder. In our case, it is IIS Logs configured to create a separate log file daily. The name of the file contains the date of its creation. Therefore, you can easily find a log file for a specific day.
By default, IIS logs are plain text files. You can easily open it in any text editor or export it to Excel for more convenient analysis.