How to enable log rotate on Tomcat Access logs
search cancel

How to enable log rotate on Tomcat Access logs

book

Article ID: 235208

calendar_today

Updated On:

Products

Data Loss Prevention

Issue/Introduction

How to rotate tomcat access logs so I only keep x number of logs.

Environment

Release : 15.8

Component :

Resolution

To enable log rotation first open server.xml from 'C:\Program Files\Symantec\DataLossPrevention\EnforceServer\<DLP Version>\Protect\tomcat\conf' with a text editor.  There are two values that you want to insert and in this example I will use 5 days.  You can use any number of days you would like to confugure.

maxDays="5"

rotatable="true"

Next look for the line that starts with "Valve className" and insert the above two properties and save the file.  For example the end result will look like the following:

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="C:/ProgramData/Symantec/DataLossPrevention/EnforceServer/15.8.00000/logs/tomcat" maxDays="5" pattern="%h %l %{currentUser}s %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; %{com.vontu.manager.session.label}s %D %S" prefix="localhost_access_log" rotatable="true" resolveHosts="false" suffix=".txt"/>

Note the maxDays and rotatable properties being set.  After this restart the Symantec DLP Manager service.  Logs the tomcat access logs will only be kept for the number of days you have configured.  

 

On the flip side if you wanted to disable the logging completely then all you have to do is comment out this line and save the file and restart the manager service.