Delete Log Files with the Logeraser Utility
To manage the size of the files generated from activity logs 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
Agiloft files and located in the
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.
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.
To configure Logeraser and change its default settings, you must have access to the file directory on the server.
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 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
-i command to print the current configuration. This shows you the directories, file masks, names, and parameters for all file sets.
The configuration contains three file sets for processing:
- jbosslogs: Consists of all files in the
.login their name.
- hprofs: Consists of files with extension
- temps: Consists of all files in the
These three file sets are standard and created automatically. In the example above, the root directory for
Agiloft files is
/shar/srv/AGILOFT_HOME . Your configuration may differ depending on your installation directory.
-F command to reference a file set to edit its parameters. For example, to change the
black parameter from 30 days to 15 days for the
jbosslogs file set, as well as to display the resulting configuration, execute the following command:
The utility makes the specified change to the referenced file set and parameter, and the resulting configuration is printed because the
-i command is used:
For each parameter you want to edit for a given file set, follow a similar process.
Test the File Processing
-n command to perform a "dry run" on the files and see which files are processed by the utility:
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.
The log files from running Logeraser itself, such as what was processed and when, are stored in the
<ROOT>/logs directory and named
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: