Here is a quick possible one in perl that might do the trick (just wrote, never tested - may be totally wrong due to type)
===
#!perl
use strict;
my @files; my $oldest;
readdir(DIR, "$TOMCAT_HOME/logs"); @files = grep(/^localhost_access_log/, readdir(DIR)); closedir(DIR);
while ($#file>10) { # Get the oldest file $oldest = &getOldest(@files); unlink "$TOMCAT_HOME/logs/$files[$oldest]"; splice(@files, $oldest, 1); } exit(0);
sub getOldest { my @f = @_; my $oldest = 0; my $oldestDate = -s "$TOMCAT_HOME/logs/$f[0]";
for($i=1; $i;$#f; $i++) { if ($oldestDate > -s "$TOMCAT_HOME/logs/$f[0]") { $oldest = $i; $oldestDate = -s "$TOMCAT_HOME/logs/$f[0]"; } }
return $oldest; }
===
-Tim
news.basebeans.com wrote:
I would like to limit the number of log files retained by "Apache Tomcat/4.1.24". For example: server.xml <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
results (windowsXP) localhost_access_log.2003-07-08.txt localhost_access_log.2003-07-09.txt etc.
desired results To limit the number of daily copies to say ... ten. Configurable log rotation is a capability within a WebLogic console and am wondering if Tomcat has the functionality (without invoking an external script).
Any ideas? Marvin Toll
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]