Configure SEAL Logrotate¶
Default Behavior¶
On Windows, SEAL Logrotate deletes old log files of SEAL Systems. NSSM rotates the log files.
During the installation, the Seal Logfile Purging task is created in the Task Scheduler Library of the Windows Task Scheduler. By default, the task behaves as follows:
- The task runs daily at 3:30 a.m.
- The task runs under the local system account
SYSTEM. - The task starts the
C:\Program Files\SEAL Systems\seal-logrotate\PurgeLogfiles.batbatch script with the argument7. - The batch script deletes all files in the
C:\ProgramData\SEAL Systems\log\log directory that were last modified 7 or more days ago.
Hint - affected files
Only files located directly in the log directory are deleted. Files in subdirectories are not affected. All files in the log directory are deleted regardless of their file extension.
If another log directory has been specified during the installation, this directory is used instead.
Hint - server not running
If the server is not running at the scheduled time, the run is skipped. It is not made up for later.
Task Definition¶
The task is defined in the C:\Program Files\SEAL Systems\seal-logrotate\PurgeLogfiles.xml file. The following elements control the behavior of the task:
StartBoundary: The time part specifies the time of day at which the task is started. Default:03:30:00DaysInterval: The task is started every<n>days. Default:1Arguments: Maximum age of the log files in days. Default:7
<Triggers>
<CalendarTrigger>
<StartBoundary>2015-01-01T03:30:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Actions Context="Author">
<Exec>
<Command>"C:\Program Files\SEAL Systems\seal-logrotate\PurgeLogfiles.bat"</Command>
<Arguments>7</Arguments>
<WorkingDirectory>C:\Program Files\SEAL Systems\seal-logrotate\</WorkingDirectory>
</Exec>
</Actions>
The XML file is only used once during the installation to create the task. After that, the XML file and the task are independent of each other:
- Changes to the XML file are not applied to the task automatically. They only become effective after you import the XML file again.
- Changes in the Task Scheduler are not written back to the XML file.
We recommend making changes in the Task Scheduler. They are effective immediately.
Adjust the Configuration in the Task Scheduler¶
Adjust the task if the log files have to be kept longer or if the task has to run at another time.
Prerequisites:
- You have administrator rights on the server.
Steps:
-
Open the Windows Task Scheduler as administrator.
-
Select
Task Scheduler Library.Hint - hidden task
The task is created as a hidden task. If
Seal Logfile Purgingis not displayed, activateView > Show Hidden Tasks. -
Double-click the
Seal Logfile Purgingtask. -
To change the time or frequency, select the
Triggerstab, select the trigger, and clickEdit. Adjust the start time or the value ofRecur every. -
To change the maximum age of the log files, select the
Actionstab, select theStart a programaction, and clickEdit. In theAdd arguments (optional)field, enter the number of days, for example14. -
Confirm the changes with
OK.
Validation:
- In the
Task Scheduler Library, theNext Run Timecolumn of theSeal Logfile Purgingtask shows the new time. - To test the task, select it and click
Run. After the run, theLast Run Resultcolumn showsThe operation completed successfully. (0x0).
Adjust the Configuration via the XML File¶
As an alternative to the Task Scheduler, you can edit the XML file and import it again. This is useful if the same configuration has to be applied to several servers.
Prerequisites:
- You have administrator rights on the server.
Steps:
-
Edit
C:\Program Files\SEAL Systems\seal-logrotate\PurgeLogfiles.xmlas administrator.Caution - encoding
The file is encoded in UTF-16. Save the file with the same encoding. Otherwise, the import fails.
-
In a PowerShell as administrator, replace the existing task with the edited definition:
schtasks /Create /TN "Seal Logfile Purging" /XML "C:\Program Files\SEAL Systems\seal-logrotate\PurgeLogfiles.xml" /F
Validation:
schtasksreports that the task has been created successfully.- In the Task Scheduler, the
Seal Logfile Purgingtask shows the new values.
Caution - update
Custom changes are lost when SEAL Logrotate is updated. For more information, refer to Update SEAL Logrotate.