Pruning IIS Logs

Standard

IIS logs on client access servers can grow to be quite large especially in an enterprise environment with thousands of clients connecting. Even with disk space monitoring in place, it is a good idea to trim the logs if they are not needed for security or other reasons. The following command will delete any log files older than 120 days and can be added to a scheduled task:

forfiles /p "C:\inetpub\logs\LogFiles" /s /m *.* /c "cmd /c Del @path" /d -120

Leave a comment