Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
/ iis-log-rotator Public archive

Internet Information Services Log Rotator

License

Notifications You must be signed in to change notification settings

geeooff/iis-log-rotator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IIS Log Rotator

Microsoft Internet Information Services Log Rotation program.

Last build

Features

  1. Autodetects installed IIS services and file logging settings
  2. Compress files older than N-days
  3. Delete files older than N-days
  4. Default settings can be overridden per-site
  5. Reports in Windows Event Log
  6. 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

  • HTTP
  • FTP
  • SMTP
  • NNTP

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

  1. Extract the program to a local folder
  2. Execute IisLogRotator.exe /s to see what logfiles will be compressed or removed
  3. 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.

  1. Execute install.cmd with Administrator rights
  2. Modify scheduled task named IIS Logs Rotation manually if not satisfied with default settings (every day at 1:00 am UTC)
  3. 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)