诺甘农圆盘

参考资料收集库

用户工具

站点工具


windows:iis:log

删除超过180天的IIS log文件 Del IIS logs older 180 days

I'm currently doing this using a very simple batch file script:

forfiles -p C:\inetpub\logs\LogFiles\ -s -m *.log -d -180 -c "cmd /C DEL @File"

I also made a Scheduled Task entry to launch it daily and even activated the file compression feature on that folder: all these things together fixed my problem with IIS files for good.

Explanation of the switches in the batch file:

  • -s or /S : recurse into all subfolders
  • -p or /P : path
  • -m or /M : file mask
  • -d or /D : number of days (-180 = older than 180 days)
  • -c or /C : command to execute

参考链接:

https://serverfault.com/questions/65329/how-can-i-keep-iis-log-files-cleaned-up-regularly

https://stackoverflow.com/questions/6919275/iis-7-log-files-auto-delete/40711754#40711754

https://www.ryadel.com/en/manage-iis-log-files-purge-older-n-days-bat-file/

windows/iis/log.txt · 最后更改: 2024/06/13 11:08 由 packingbox