您可以轮换日志,然后选择要删除的日志文件
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" rotatable="true" renameonRotate="true" pattern="%h %l %u %t "%r" %s %b" />
由于旋转默认设置为true,因此您应该已经拥有它。然后您可以例如删除5天以上的日志:
要删除超过10天的日志文件,可以使用以下命令。
Unixfind /path/to/httplogs/ -name "*.log" -type f -mtime +10 -exec rm -f {} ;For Windows Server OS:forfiles /p "C:pathtohttplogs" /s /m *.log /d -10 /c "cmd /c del @PATH"


