logging - Tomcat localhost_access_log files cleanup -
we have solr running on tomcat 8. having issues in our different environments localhost_access_log files filling servers. these files created access valve log in server.xml configured -
<valve classname="org.apache.catalina.valves.accesslogvalve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
from i've read, there no ootb way in tomcat clean old log files. can implement clean old access log files?
you can have log rotation , choose logs files delete
<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" />
as rotation set true default should have it. can exemple delete logs older 5 days:
to delete log files older 10 days following commands can used.
unix find /path/to/httplogs/ -name "*.log" -type f -mtime +10 -exec rm -f {} \; windows server os: forfiles /p "c:\path\to\httplogs" /s /m *.log /d -10 /c "cmd /c del @path"
Comments
Post a Comment