3

Hi,

This isn’t a question but simply a small script i’d like to share with the community.  I have no idea if people will find a use for it.

It’s always amazed me that IIS has no in built mechanism for log management.  It’s very good at writing log data but there is no provision for handling log retention or deleting old logs when they get to a specific age.  In many cases we would often see that when a low disk space alert was fired the ‘go to’ fix was simply to clean the log files down.

I’ve therefore written a simple script which will clear the logs down based on some JSON configuration; I will happily share that but this first one will read the IIS configuration and then report some metrics for each website that is defined on the Server.

Once the the task is defined you can use Squared Ups On-Demand Task widget to have it present information about the logs alongside other IIS information (in my case I just added it to the existing perspective).

The script is below for those that want it.

If people would like me to post the cleanup script as well then please let me know.

Any questions or issues then please let me know and i’ll do my best to help.

Pete

Ruben Zimmermann answered