You may wish to periodically delete certain log files to To manage the size of the files generated from activity logs , for example. This can be done with the utility called logeraser,
which is installed in the standard set of
Companyname |
---|
Companyname |
---|
<ROOT>/bin
directory.Processing Algorithm
All processed files are divided in several independently named file sets, defined by the file mask and identified by name. Each file set processed independently and has its own parameters.
- All files in file set older than 'black files age' are deleted unconditionally.
- All files in file set younger than 'white files age' are kept unconditionally.
- Files older than 'zip files age' are zipped.
- Files older than 'white age' but younger than 'black age', called 'gray files,' are removed, in order from oldest to newest, provided that free disk space in percents is less than 'start threshold' parameter. This process finishes when all gray files are removed or free disk space raises up to 'Finish threshold' parameter.
Command Line Options for logeraser
The short reference by logeraser command line option is printed when the utility runs without parameters:
The logeraser utility works by deleting, keeping, or compressing files based on the age of files in a given file set and the amount of free disk space you want. The utility automatically adds files to different file sets based on a default file mask, which is a method for finding and grouping files using a regular expression, or regex. You can define your own file mask, as well as how files are processed in each file set by defining parameters for file age and disk space.
Info | ||
---|---|---|
| ||
Consider a file set You may also have another file set |
You do not need to manually run the utility to delete files, except to change the configuration settings. The utility automatically deletes any files that meet the configuration parameters. By default, log files in the default file sets are deleted after 30 days.
Info | ||
---|---|---|
| ||
To configure Logeraser and change its default settings, you must have access to the file directory on the server. |
Processing Algorithm
Each file set contains independent parameters that determine which files Logeraser deletes, keeps, and compresses:
black
: Files older than this age are deleted unconditionally.white
: Files younger than this age are kept unconditionally.zip
: Files older than this age are compressed, or zipped.
Gray Files
Gray files are files older than the white
parameter but younger than the black
parameter. Logeraser deletes gray files in order from oldest to newest until a defined percentage of disk space is free. Two parameters define the the amount of disk space that affect gray files:
startthreshold
: Defines the amount of free disk space that must be unavailable before Logeraser begins deleting gray files. If you have more free disk space than is defined by this parameter, no gray files are deleted.finishthreshold
: Defines the amount of free disk space that must be available before Logeraser stops deleting gray files. When the free disk space reaches the amount defined by this parameter, the remaining gray files are kept.
Delete Log Files
To configure Logeraser, go to the <ROOT>/bin
directory containing the utility and open it. The utility uses commands and parameters that you need to enter in the command line to change the utility's configuration. For a full list of commands and parameters, see Logeraser Reference at the end of this article.
The default settings for Logeraser are typically sufficient for most purposes. If you want to change the configuration, follow each section below in order.
Print the Current Configuration
Use the -i
command to print the current configuration. This shows you the directories, file masks, names, and parameters for all file sets.
Code Block | ||
---|---|---|
| ||
server32b:/shar/srv/AGILOFT_HOME # ./bin/logeraser -i
Main parameters:
| ||
Code Block | ||
server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser usage: Usage -B,--black Black files age for configured file set -D,--directory Directory for configured file set -E,--before Insert new fileset before named -F,--fileset File set name for subsequent usage -M,--mask File names mask for configured file set -R,--remove Remove file set from config -S,--subdirs Process subdirectories for configured file set -T,--finishthreshold Finish threshold value -W,--white White files age for configured file set -Z,--zip Zip files age for configured file set -c,--console Output to console -i,--info Print current configuration -n,--dryrun Dry run (no files removed) -r,--run Installation root : /shar/srv/AGILOFT_HOME Do erase old log files -t,--startthreshold Log Startfile threshold value -v,--verbose: /shar/srv/AGILOFT_HOME/logs/logeraser.log Start threshold : Verbose output |
Print Current Configuration
Use the option -i to print the current configuration:
Code Block |
---|
server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -i Main parameters50 Finish threshold : 55 File sets: Installation root : /shar/srv/EnterpriseWizard name : jbosslogs Log fileDirectory : /shar/srv/EnterpriseWizard/logs/logeraser./AGILOFT_HOME/jboss/server/sw/log Start threshold : 50 File Finish thresholdmask : 55 File sets: .+\.log.* Process subdirs : false Delete older namethan : jbosslogs 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010) Keep younger Directorythan : /shar/srv/EnterpriseWizard/jboss/server/sw/log 7 days (Mon Mar 08 04:11:38 GMT+00:00 2010) File maskZip : .+\.log.* Process subdirs : false older than : 2 days (Sat Mar 13 04:11:38 GMT+00:00 2010) Delete older than : 30 days (Sat Feb 13name 04:11:38 GMT+00:00 2010) hprofs Keep younger than : 7 days (Mon Mar 08Directory 04:11:38 GMT+00:00 2010) : /shar/srv/AGILOFT_HOME/jboss/bin Zip older than : 2 days (Sat MarFile 13mask 04:11:38 GMT+00:00 2010) .+\.hprof Process subdirs : false name : hprofs Delete older than : 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010) Directory : /shar/srv/EnterpriseWizard/jboss/bin Keep younger than : not set File mask : .+\.hprof Zip older than : not set Process subdirs : false Delete older thanname : 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010) temps Keep younger thanDirectory : not set /shar/srv/AGILOFT_HOME/tmp Zip olderFile thanmask : not set .+ Process subdirs : true name : temps Delete older than : 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010) Directory : /shar/srv/EnterpriseWizard/tmp Keep younger than : not set File mask : .+ Zip older than : Process subdirs : true Delete older than : 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010) Keep younger than : not set Zip older than : not set |
File Sets
The three file sets defined here for processing are:
- jbosslogs – consists of all files in
/shar/srv/EnterpriseWizard/jboss/server/sw/log
directory with.log
in their name. Note that file mask here is a regular expression, not an OS file mask pattern. - hprofs – consists of files with suffix
.hprof
in/shar/srv/EnterpriseWizard/jboss/bin
directory. - temps – consists of all files in
/shar/srv/EnterpriseWizard/tmp
directory.
...
not set
|
File Sets
The configuration contains three file sets for processing:
- jbosslogs: Consists of all files in the
/shar/srv/AGILOFT_HOME/jboss/server/sw/log
directory with.log
in their name. - hprofs: Consists of files with extension
.hprof
in the/shar/srv/AGILOFT_HOME/jboss/bin
directory. - temps: Consists of all files in the
/shar/srv/AGILOFT_HOME/tmp
directory.
Note |
---|
These three file sets are standard and created automatically. In the example above, the root directory |
...
for
|
...
files is |
...
|
...
Edit Parameters
The option Use the -F
is used command to reference some a file set in order to change edit its parameters.
Example
For For example, to change the 'black
' files age parameter from 30 days to 15 days for the jbosslogs
file set, as well as to display the resulting configuration, execute the following command:
Code Block | ||
---|---|---|
| ||
server32b:/shar/srv/EnterpriseWizardAGILOFT_HOME # ./bin/logeraser -F jbosslogs -B 15 -i |
The following output is received. Note that utility makes the specified change to the referenced file set and parameter, and the resulting configuration is printed because the -i
option command is given.used:
Code Block | ||
---|---|---|
| ||
server32b:/shar/srv/EnterpriseWizardAGILOFT_HOME # ./bin/logeraser -F jbosslogs -B 15 -i Main parameters: Installation root : /shar/srv/EnterpriseWizardAGILOFT_HOME Log file : /shar/srv/EnterpriseWizardAGILOFT_HOME/logs/logeraser.log Start threshold : 50 Finish threshold : 55 File sets: name : jbosslogs Directory : /shar/srv/EnterpriseWizardAGILOFT_HOME/jboss/server/sw/log File mask : .+\.log.* Process subdirs : false Delete older than : 15 days (Sun Feb 28 05:08:04 GMT+00:00 2010) Keep younger than : 7 days (Mon Mar 08 05:08:04 GMT+00:00 2010) Zip older than : 2 days (Sat Mar 13 05:08:04 GMT+00:00 2010) 05:08:04 GMT+00:00 2010) name : hprofs Directory : /shar/srv/AGILOFT_HOME/jboss/bin File mask : .+\.hprof Process subdirs : false Delete older than : 30 days (Sat Feb 13 05:08:04 GMT+00:00 2010) Keep younger than : not set Zip older than : not set name : temps Directory : /shar/srv/AGILOFT_HOME/tmp File mask : .+ Process subdirs : true Delete older than : 30 days (Sat Feb 13 05:08:04 GMT+00:00 2010) Keep younger than : not set Zip older than : not set |
For each parameter you want to edit for a given file set, follow a similar process.
Test the File Processing
Use the -n
command to perform a "dry run" on the files and see which files are processed by the utility:
Code Block |
---|
server32b:/shar/srv/AGILOFT_HOME # ./bin/logeraser -F jbosslogs -n -r -v -c
|
If the files are processed as you expect, remove the -n
command and run the utility to immediately remove the desired log files. In the future, log files meeting the configuration settings are automatically processed by the utility. You do not need to manually run Logeraser.
Note |
---|
The log files from running Logeraser itself, such as what was processed and when, are stored in the |
Logeraser Reference
The following list is a reference of all Logeraser commands and parameters. To see this list in Logeraser, run the utility without entering any options:
Code Block | ||
---|---|---|
| ||
server32b:/shar/srv/AGILOFT_HOME # ./bin/logeraser usage: Usage -B, black name : hprofs Black file age of the configured file set -D, directory Directory : /shar/srv/EnterpriseWizard/jboss/bin of the configured file set -E, before Insert new file Fileset maskbefore : .+\.hprof named -F, fileset File set Processname subdirsfor : falseconfiguration -M, mask Delete older than : 30File daysname (Satmask Febfor 13 05:08:04 GMT+00:00 2010) the configured file set -R, remove Keep youngerRemove thanfile :set notfrom setconfiguration -S, subdirs Process sub-directories Zipfor olderthe thanconfigured : notfile set -T, finishthreshold Finish threshold value -W, white White file nameage :of temps the configured file set -Z, zip Directory : /shar/srv/EnterpriseWizard/tmp Zip file age of the configured file set -c, console File maskOutput :to .+ console -i, info Process subdirsPrint :current trueconfiguration -n, dryrun Delete older than : 30 days (Sat FebDry 13 05:08:04 GMT+00:00 2010run (no files removed) -r, run Keep younger than : not set Remove old log files -t, startthreshold Start threshold value Zip older than : not set |
...
You can see which files will be processed by doing a 'dry run' using the -n
option.
Code Block |
---|
server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -F jbosslogs -n -r -v -c
|
Logeraser Log Files
...
-v, verbose Verbose output
|
Hide If | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
Related articles
|
...
|
...
|