Skip to end of metadata
Go to start of metadata

Delete Log Files with Logeraser Utility

You may wish to periodically delete certain log files to manage the size of the logs, for example. This can be done with the utility called logeraser, which is installed in the standard set of  Agiloft files and located in the <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:

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                Do erase old log files
 -t,--startthreshold     Start threshold value
 -v,--verbose            Verbose output

Print Current Configuration

Use the option -i to print the current configuration:

server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -i

Main parameters:
        Installation root : /shar/srv/EnterpriseWizard
                 Log file : /shar/srv/EnterpriseWizard/logs/logeraser.log
          Start threshold : 50
         Finish threshold : 55

File sets:
                          name : jbosslogs
                     Directory : /shar/srv/EnterpriseWizard/jboss/server/sw/log
                     File mask : .+\.log.*
               Process subdirs : false
             Delete older than : 30 days (Sat Feb 13 04:11:38 GMT+00:00 2010)
             Keep younger than : 7 days (Mon Mar 08 04:11:38 GMT+00:00 2010)
                Zip older than : 2 days (Sat Mar 13 04:11:38 GMT+00:00 2010)

                          name : hprofs
                     Directory : /shar/srv/EnterpriseWizard/jboss/bin
                     File mask : .+\.hprof
               Process subdirs : false
             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

                          name : temps
                     Directory : /shar/srv/EnterpriseWizard/tmp
                     File mask : .+
               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.


Note: these three file sets are standard and created automatically. In the example above, the root directory for  Agiloft files is /shar/srv/EnterpriseWizard – your configuration may differ.

Changing Parameters

The option -F is used to reference some file set in order to change its parameters.

Example

For example, to change the 'black' files age from 30 days to 15 days, execute the command:

server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -F jbosslogs -B 15 -i

The following output is received. Note that the resulting configuration is printed because the -i option is given.

server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -F jbosslogs -B 15 -i

Main parameters:
        Installation root : /shar/srv/EnterpriseWizard
                 Log file : /shar/srv/EnterpriseWizard/logs/logeraser.log
          Start threshold : 50
         Finish threshold : 55

File sets:
                          name : jbosslogs
                     Directory : /shar/srv/EnterpriseWizard/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)

                          name : hprofs
                     Directory : /shar/srv/EnterpriseWizard/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/EnterpriseWizard/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


Test File Processing

You can see which files will be processed by doing a 'dry run' using the -n option.

server32b:/shar/srv/EnterpriseWizard # ./bin/logeraser -F jbosslogs -n -r -v -c

Logeraser Log Files

The log files from running logeraser itself, such as what was processed and when, are stored in <root>/logs directory and named logeraser.log
Files are rotated.