How to Configure Logging in IIS

How to Configure Logging in IIS

IIS logging enables a manual way for you to read log files, in terms of all activities of visitor and server. With the analysis of log data, you can take an easy control of content popularity and security requirements. It is great to get real-time logs and identify any potential threats to your website. This detailed guide briefs you on how to configure IIS logging step by step and that should be set via IIS Manager.

IIS has launched a list of formats to save long files, including W3C, IIS Format, NCSA and Centralized Binary Logging, among which W3C Extended Log File Format is selected by default thanks to its usability. That allows you to customize any log data as needed, in terms of server port, username, URI stem, and so on.

Step 1: The process of opening IIS Manager mentioned here is completed on Windows 7 operating system. Click “Start” menu to target Control Panel from the right column. Open your control panel and continue with the following steps.

Open Control Panel

Step 2: Here you come to the control panel with an array of settings for your computer. Before everything, turn on IIS Manager if you have never taken it into effect. Access to Programs setting page and double-click “Turn Windows Features on or off” under Programs and Features item.

Control Panel Programs

Step 3: Check “Internet Information Services” and click “OK” to turn the IIS Manager on. It might take several minutes to enable this feature.

Turn on IIS Manager

Step 4: Go back to control panel and switch to Small icons view. Double-click Administrative Tools to target Internet Information Services (IIS) Manager from a list of options.

Adminitrative Tools

Step 5: Expand your server name > Sites > your website. Keep “Features View” for the Website Home interface and click “Logging”. Two sections including Log File and Log File Rollover are available for logging configuration.

Website Home Logging

Step 6: Select a format from four options as what we’ve mentioned at the start. Here, we leave the default W3C format as planned. And then, click “Select Fields” and make a decision on which fields should be logged on W3C from multiple fields. The default directory path to store log files is %SystemDrive%\inetpub\logs\LogFiles and that allows you to make a change if needed.

Logging Format Directory

Step 7: Move to the Log File Rollover mode. There are three methods available for you to create a new log file, including Schedule, Maximum file size and Do not create new log files. Each has its own function and that is explained as below.

Log File Rollover

  • Schedule – Determine how often to create a new log file, which is available for once per hour, day, week or month. It’s up to you.
  • Maximum file size (in bytes) – This function enables you to set the maximum size for an existing file. When the file limit reached, a new log file will be created automatically. Note that, the value should be set more than 1048576 bytes.
  • Do not create new log files – Keep using an existing log file and never create a new one.

Check the option “Use local time for file naming and rollover” to make sure that there is no difference between all schedules and the local server. Finally, click “Apply” under Actions to run the settings.