The ”History” table in the NConf database keeps a record of all modifications made by users. All logins, add, modify and delete operations are logged there. Over time, a lot of data can accumulate, making it necessary to clear the history once in a while. As of NConf 1.2.5, we provide a history_cleanup.sh script located in the ADD-ONS folder. With it you can easy cleanup your history entries.
First of all you need to configure the cleanup script. Open the script with 'vi', enter the NConf database name and username information for accessing the database:
if your security allows it, you can also configure the password, otherwise it will be asked for at runtime
(the password must be given if you want to execute the script automatically (for example with crontab)
Configure UNIT and INTERVAL according to your needs:
should be one of these : “SECOND”, “MINUTE”, “HOUR”, “DAY”, “WEEK”, “MONTH”, “QUARTER”, or “YEAR”
should be an integer value
All history entries older than the specified interval will be deleted. For example, to delete all history entries which are older than a month, configure the following interval:
UNIT = "MONTH" INTERVAL = "1"
You can either run the script manually on the commandline, or set up a cronjob for it.
Run manually with arguments
You may also pass the UNIT and INTERVAL as commandline arguments:
$> ADD-ONS/history_cleanup.sh DAY 5
This will delete all history entries older than 5 days.
Run by crontab
Create a crontab entry to periodically execute your cleanup script.
Make sure that you've configured the PASSWORD for the database in the script!
$> vi /etc/crontab 00 01 * * * root /path/to/nconf/ADD-ONS/history_cleanup.sh MONTH 1
This will run daily at 01:00am and erase any entries older than a month.