IIS Log Rotator
Microsoft Internet Information Services Log Rotation program.

Features
- Autodetects installed IIS services and file logging settings
- Compress files older than N-days
- Delete files older than N-days
- Default settings can be overridden per-site
- Reports in Windows Event Log
- Simulation mode (or what if…) can be used
Supported IIS versions
- IIS 5.0
- IIS 5.1
- IIS 6.0
- IIS 7.0
- IIS 7.5
- IIS 8.0
- IIS 8.5
- IIS 10.0
Supported IIS services
Web Management Service (WMSvc) logs are not yet supported.
System requirements
- Microsoft .NET Framework 4.8
- Windows Server 2008 / Vista only: IIS 6 Metabase Compatibility feature
- Administrator rights (because of WMI and IIS Metabase readings)
How to run
- Extract the program to a local folder
- Execute
IisLogRotator.exe /s to see what logfiles will be compressed or removed
- Execute
IisLogRotator.exe to compress or delete logfiles definitively
How to install / schedule
If you need to execute the program daily and have reports to Windows Event Log,
you should register it to Windows Task Scheduler.
- Execute
install.cmd with Administrator rights
- Modify scheduled task named
IIS Logs Rotation manually if not satisfied with default settings (every day at 1:00 am UTC)
- Enable scheduled task named
IIS Logs Rotation manually, or execute SCHTASKS /Change /TN "IIS Logs Rotation" /ENABLE
How to uninstall / unschedule
- To remove everything, execute
uninstall.cmd with Administrator rights
- To disable the scheduled task, disable Windows scheduled task named
IIS Logs Rotation, or execute SCHTASKS /Change /TN "IIS Logs Rotation" /DISABLE
Settings
Open the IisLogRotator.config file with an XML-aware editor (like Visual Studio Code, Sublime Text) to avoid errors.
Defaults
Default settings are set on the /configuration/rotation/defaultsSettings XML node.
Example for compression after 7 days, and deletion after 2 years :
<rotation>
<defaultSettings compress="true" compressAfter="7" delete="true" deleteAfter="730"/>
</rotation>
Site-specific settings
To specify site-specific settings, you have to find its service code and ID,
then add to your settings in a siteSettings/siteSettings node with the ID set to the id attribute.
Example for W3SVC1 Website settings, to do deletion only after 30 days :
<rotation>
<defaultSettings compress="true" compressAfter="7" delete="true" deleteAfter="730"/>
<siteSettings>
<siteSettings id="W3SVC1" compress="false" delete="true" deleteAfter="30"/>
</siteSettings>
</rotation>
rotation element allowed attribute values
| Attribute |
Values |
enableEventLog |
true to enable Windows event log reports or false (default) to disable |
Windows event logs reports are enabled when the program is installed using install.cmd and should not be enabled without,
or Windows will complain about missing event log source identifier.
defaultSettings / siteSettings elements allowed attribute values
| Attribute |
Values |
compress |
true to enable compression or false to disable |
compressAfter |
Number of days (must be greater than zero) |
delete |
true to enable deletion or false to disable |
deleteAfter |
Number of days (must be greater than compressAfter if delete and compress are true) |
评论