Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 and other system activity, it can be useful to delete past log files. For example, it's often useful to simply delete any log files after a set amount of time has passed, such as every month or quarter. This is done automatically with a utility called Logeraser, which is installed in the standard set of of

Companyname
 files 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:

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                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:

...

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
titleExample

Consider a file set A that contains all files with an extension of .log in directory X. In this set, you can choose to delete all files older than 180 days, keep files younger than 30 days, and compress files older than 5 days. You can also choose to delete files older than 30 days but younger than 180 days until you have at least 50 percent of free disk space.

You may also have another file set B that contains all files with an extension of .hprof in directory Y . In this set, you can define the file age parameters differently, such as choosing to delete all files older than 90 days, keep files younger than 10 days, and compress files older than 1 day. However, when you delete files older than 10 days but younger than 90 days, you must use the same disk space parameter for all file sets.

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
titlePrerequisite

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
languagevb
server32b:/shar/srv/AGILOFT_HOME # ./bin/logeraser -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 : 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/EnterpriseWizardAGILOFT_HOME/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/EnterpriseWizardAGILOFT_HOME/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 configuration contains three file sets defined here for processing are:

  • jbosslogs – consists : Consists of all files in in the /shar/srv/EnterpriseWizardAGILOFT_HOME/jboss/server/sw/log log directory with with .log log in their name. Note that file mask here is a regular expression, not an OS file mask pattern.
  • hprofs – consists : Consists of files with suffix .hprof in extension .hprof in the /shar/srv/EnterpriseWizardAGILOFT_HOME/jboss/bin bin directory.
  • temps – consists temps: Consists of all files in in the /shar/srv/EnterpriseWizardAGILOFT_HOME/tmp tmp directory.

...

Note

These three file sets are standard and created automatically. In the example above, the root directory

...

for

Companyname

...

files is /shar/srv/

...

AGILOFT_HOME . Your configuration may differ depending on your installation directory.

...

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 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
languagevb
server32b:/shar/srv/EnterpriseWizardAGILOFT_HOME # ./bin/logeraser -F jbosslogs -B 15 -i

The following output is received. Note that the 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
languagevb
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)

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

You can Use the -n command to perform a "dry run" on the files and see which files will be processed by doing a 'dry run' using the -n option.are processed by the utility:

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

Logeraser Log Files

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 <ROOT>/logs

...

directory and

...

named logeraser.log.

...

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
languagevb
server32b:/shar/srv/AGILOFT_HOME # ./bin/logeraser
usage: Usage

 -B, black              Black file age of the configured file set
 -D, directory          Directory of the configured file set
 -E, before             Insert new file set before named
 -F, fileset            File set name for configuration
 -M, mask               File name mask for the configured file set
 -R, remove             Remove file set from configuration
 -S, subdirs            Process sub-directories for the configured file set
 -T, finishthreshold    Finish threshold value
 -W, white              White file age of the configured file set
 -Z, zip                Zip file age of the configured file set
 -c, console            Output to console
 -i, info               Print current configuration
 -n, dryrun             Dry run (no files removed)
 -r, run                Remove old log files
 -t, startthreshold     Start threshold value
 -v, verbose            Verbose output


Hide If
displayprintable

Content by Label
showLabelsfalse
max5
spacesPROD
showSpacefalse
sorttitle
typepage
cqllabel = "activity

...

" and type = "page" and space

...

in (currentSpace(),"HELP")
labelsrest api integration