If you are running OpenEdge 11.7 or later, best practice suggests using its log truncate and archive feature. Here's how.
Set the following database startup parameters according to your needs.
Here is an example of db startup parameters to perform a weekly database lg file archive and truncate that occurs on Sunday a minute past midnight:
Parameter | Value | Note |
-lgTruncateFrequency | 7 | Sunday |
-lgTruncateTime | 00:01 | one minute past midnight |
-lgArchiveEnable | add it to your pf to enable lg file archiving | |
-lgArchiveDir | D:\db\lgarc or /data/db/lgarc | explicit path to the directory to store db lg archives |
Purging db lg file archives
We generally recommend keeping at least a year's worth of log files (disk space is cheap). At the very least, if Progress audits you, you will need two or three months of database and application log files.
OpenEdge does not provide a db startup parameter to purge db lg file archives, we use OS tools for this.
NOTE: What follows are general examples and guidelines, use them at your own risk. Configure and test them in a development environment before deploying them to production.
Linux
You might use cron to do this:
15 0 * * 0 find /data/db/lgarc -type f -mtime +365 -delete
Windows
You might create a Powershell script to this effect (C:\protop\bin\purge_db_lgarcs.ps1):
$Path = "D:\db\lgarc"
$Days = 365
$Cutoff = (Get-Date).AddDays(-$Days)
Get-ChildItem -Path $Path -File | Where-Object {$_.LastWriteTime -lt $Cutoff} | Remove-Item -Force
Then in Task Scheduler:
1. Create a basic task and name/describe it.
2. Trigger: Weekly on Sunday at 00:15
3. Action: Start a Program
4. Program/script: powershell.exe
Add arguments: -ExecutionPolicy Bypass -File "C:\protop\bin\purge_db_lgarcs.ps1"
5. Review and finish
6. Test, test test!
For more details and other options, like truncating based on size, see OpenEge Log file truncate and archive.