IIS 7 日志文件自动删除?

IIS 7 Log Files Auto Delete?(IIS 7 日志文件自动删除?)

本文介绍了IIS 7 日志文件自动删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IIS 7 中是否有任何功能可以自动删除超过指定天数的日志文件?

Is there any feature in IIS 7 that automatically deletes the logs files older than a specified amt of days?

我知道这可以通过编写脚本(并每周运行它)或 Windows 服务来完成,但我想知道是否有任何内置功能或可以做到这一点的东西.

I am aware that this can be accomplished by writing a script(and run it weekly) or a windows service, but i was wondering if there is any inbuilt feature or something that does that.

此外,目前我们关闭了注销,因为它会堆积大量空间.会有问题吗?

Also, Currently we turned logging off as it is stacking up a large amount of space. Will that be a problem?

推荐答案

您可以使用管理工具 > 任务计划程序创建每天运行的任务.

You can create a task that runs daily using Administrative Tools > Task Scheduler.

将您的任务设置为运行以下命令:

Set your task to run the following command:

forfiles /p "C:inetpublogsLogFiles" /s /m *.* /c "cmd /c Del @path" /d -7

此命令适用于 IIS7,它会删除所有一周或更早的日志文件.

This command is for IIS7, and it deletes all the log files that are one week or older.

您可以通过更改 /d arg 值来调整天数.

You can adjust the number of days by changing the /d arg value.

这篇关于IIS 7 日志文件自动删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:IIS 7 日志文件自动删除?

基础教程推荐