3 tomcat log management on windows, Tomcat log management on windows – Acronis Access - Installation Guide User Manual
Page 23

23
Copyright © Acronis International GmbH, 2002-2014
2.3 Tomcat Log Management on Windows
As part of its normal operation Tomcat creates and writes information to a set of log files.
Unless periodically purged, these files accumulate and consume valuable space. It is commonly
accepted by the IT community that the informational value those logs provide degrades rapidly.
Unless other factors like regulations or compliance with certain policies play, keeping those log files
in the system a discrete number of days is what is required.
Introduction:
As part of its normal operation Tomcat creates and writes information to a set of log files. On
Windows, these files are normally located in the following directory:
“C:\Program Files (x86)\Acronis\Access\Common\apache-tomcat-7.0.34\logs”
Acronis Access saves it's own logs in the same directory as separate files.
Acronis Access's log files are named acronisaccess_date.
There are many tools capable of automating the task of deleting unneeded log files. For our example,
we will use a built-in Windows command called ForFiles.
Info: For information on ForFiles, syntax and examples visit
http://technet.microsoft.com/en-us/library/cc753551(v=ws.10).aspx
A sample process:
The sample process described below automates the process of purging log files older than a certain
number of days. Inside the sample batch file, this number is defined as a parameter so it can be
changed to fit different retention policies.
Info: The sample script (batch) file is designed to work on Windows 2008. Click here to download the script.
Optionally you could copy and paste the script code into an empty text document and save it as
“AASTomcatLogPurge.bat”
Click here for the full batch script code...
ECHO OFF
REM Script: aETomcatLogsPurge.bat
REM 2012-05-12: Version: 1.0: MEA: Created
ECHO This script will delete files older than a number of days from a directory
ECHO Run it from the command line or from a scheduler
ECHO Make sure the process has permissions to delete files in the target folder
REM ===== CONFIGURATIONS ===================================================
REM Note: all paths containing spaces must be enclosed in double quotes
REM Edit this file and set LogPath and NumDays below
REM Path to the folder where all Tomcat logs are
set LogPath="C:\Program Files (x86)\Group Logic\Common\apache-tomcat-7.0.34\logs"