Personally. I rely on a daily cron with a find by time and the -delete flag. Where the time to keeps is based on policy.
-Tim On Tue, Mar 18, 2025 at 9:52 AM Nguyen, Quoc A. (QUANTUM MANAGEMENT, LLC) <quoc.ngu...@va.gov.invalid> wrote: > Hello, > > Tomcat server version: 9.0.98. > > server.xml configuration for AccessLogValve: > > <Valve className="org.apache.catalina.valves.AccessLogValve" > directory="logs" prefix="localhost_access_log" suffix=".log" maxDays="7" > pattern="%h %{X-Forwarded-For}i %t %I "%m %U" %{local}p %s %b %D" > resolveHosts="false" /> > > Everything works fine. Now, I have a requirement to archive these log > files similar to log4j <RollingFile> (pattern is already taken care of in > the valve) with <Policies> (archive when the file size reaches certain > size) and <DefaultRolloverStrategy> (cleanup archived files). > > Is there a way to archive these logs via the configuration in the valve? > If not, what the best way to go about it: a custom class that implements > ValveBase or extends AccessLogValve or do something else entirely? > > >