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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)