n天后如何删除Tomcat访问日志? [英] How to delete Tomcat Access Log after n days?
问题描述
我只想保留Tomcat Access Log Valve创建的最近n天的访问日志. http://tomcat.apache.org/tomcat -6.0-doc/config/valve.html#Access%20Log%20Valve
但是似乎没有配置属性来定义将日志文件保留多长时间?我猜这是因为访问日志阀"仅创建日志文件而不删除它们,对吗?
对于访问日志,默认情况下rotatable
为true,因此您将每24小时创建一个新文件.
Tomcat本身不对旧文件进行任何内务处理,Unix系统上的一般原则是在系统上设置cron作业,以将旧文件存档到备份目录中和/或删除它们.>
I only would like to keep the Access Logs of the last n days created by Tomcat Access Log Valve. http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access%20Log%20Valve
But there seems to be no configuration-Attribute to define how long to keep the log-files? I guess this is because "Access Log Valve" only creates log files and doesn't delete them, is that correct?
By default rotatable
is true for Access Log, so you will be having a new file created every 24 hours.
Tomcat itself does not do any housekeeping on the old files, the general principle on a Unix system is to have a cron job set up on the system to archive older files into a back up directory and/or delete them.
这篇关于n天后如何删除Tomcat访问日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!