Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete Tomcat Access Log after n days?

Tags:

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?

like image 360
Andreas Avatar asked May 05 '10 09:05

Andreas


People also ask

Can I delete Tomcat logs?

You can delete all logs. Those from the current date will not be deletable while Tomcat is running, but that is ok.

Where we can see Tomcat logs?

The main Apache Tomcat configuration file is at /opt/bitnami/tomcat/conf/server. xml. Once Apache Tomcat starts, it will create several log files in the /opt/bitnami/tomcat/logs directory.


1 Answers

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.

like image 78
shinynewbike Avatar answered Sep 30 '22 17:09

shinynewbike