Housekeeping

Maintaining the health and efficiency of the Repstance Server involves regular housekeeping tasks. This includes cleaning up the trail and log files that are no longer needed. Regular cleanup helps prevent storage issues and ensures that the server runs smoothly. Here’s how you can manage these tasks effectively:

1. Schedule a Regular Cleanup Job: The Apply Processes clean up the trail files themselves (see below), so only the log files need a cleanup job. You can create and schedule such a job using cron on your Linux server. The job will automatically delete or archive the files older than a certain age.

Directories to Clean:

/opt/repstance/trail: This directory contains the trail files that are written by the Capture Processes and read by the Apply Processes. The Apply Processes delete a trail file when every Apply Process that reads it has applied it. The cleanuptrail parameter of the Apply Process sets the number of days to keep the applied trail files: 0 – delete the files as soon as they are applied (the default), -1 – never delete the files (see Prepare Apply Process). Do not delete the trail files manually or with a scheduled job: a file that has not been applied yet contains the changes that would be lost.

/opt/repstance/log: This directory contains log files, a new log file is started every day for each Process. Repstance does not delete the log files, so remove the old ones regularly. This keeps your system organized and prevents log files from consuming too much disk space.

The log files are named process-id-dd-mm-yyyy.log, for example capture-1-04-10-2026.log or apply-10-04-10-2026.log, and a file is not written to after its day. The following line deletes the log files that are older than 30 days every night at 03:00. Add it to the crontab of the root user (sudo crontab -e) and change 30 to the number of days to keep:

0 3 * * * find /opt/repstance/log -type f -name '*.log' -mtime +30 -delete

Incident files: the log directory also holds the files inc_dd-mm-yyyy.im, one small file for each day on which an incident happened. They are the list of Incident Management in the Web UI (a failed process, or a warning that a feature is not available on the instance). Repstance does not delete them and the line above leaves them alone, because it deletes the *.log files only. Delete the incidents that are dealt with in Incident Management; if you remove an old file by hand, the incidents of that day disappear from the list.

2. Regular Monitoring: It's important to monitor the disk usage and performance regularly to ensure that the cleanup jobs are working as expected and that no necessary files are accidentally deleted.

 
On this page