PortalGuard Log Rotation and Log Clean-up
- Your PortalGuard server is running low on disk space -OR-
- Your PortalGuard server has run out of disk space -OR-
- Prior days' PortalGuard run-time logs are gathering in the "Logs" folder.
Low disk space on the drive where PortalGuard writes its run-time logs can become a problem if you leave the Log Level in PG_Config.exe or IdP_Config.exe set to "Trace" for an extended period of time (e.g. weeks or months). This can crash your PG server so do NOT let this happen to you! Please see our other KB on how to modify these Log Level settings.
To combat this, PortalGuard has a specific process responsible for moving prior days' logs out of the base "Logs" folder into the "Logs\old" folder. More importantly this process also deletes log files from the "Logs\old" directory older than a configurable threshold (default of 30 days). When enabled, the Log_Rotation.exe process runs as a daily scheduled task. The information below details how to ensure this is setup and configure it to your liking.
One of the first things you absolutely must do after installing PortalGuard is run its Initial Setup. You only need to do this once, but running it multiple times will not have adverse effects.
- On the PortalGuard Server, navigate to the PortalGuard Configuration Editor and click on the 'Actions'menu:
- Once in the Actions menu, select 'Initial Setup':
- A new window will open. Click the 'Start' button:
- NOTE: You will only see the dialog below If you have already run the Initial Setup. Since you do not have Log Rotation enabled, you will most likely NOT see it. However, if you do see it, click 'No' (the 'safer' option) to keep the logging data in the existing PortalGuard Windows Event Log. If, however, you want to delete & recreate the PortalGuard Event Log, then click 'Yes' :
- The 3rd and final task of Initial Setup is a request to enable Password Expiration Reminder Emails. If you are seeing this prompt, that means you do NOT already have them enabled so you should absolutely click 'No'! Details on that feature are in a different, less fun KB. Stay on task, stick with this KB about log rotation and click 'No' on the dialog below!
- As mentioned above, by default, the Log Rotation will delete any files from the "Logs\old" directory that are older than 30 days. If you would like to change this threshold, launch a text editor (like Notepad++) as an administrator.
- Open the following file: C:\Program Files\PistolStar\PortalGuard\bin\LogRotation.exe.config
- NOTE: If you do not see this file, then you have an older version of PortalGuard. You must:
- Download the updated LogRotation.exe (v188.8.131.52) from this box.com URL
- "Unblock" the zip file (right-click it, Properties -> then the "Unblock button or checkbox)
- In the C:\Program Files\PistolStar\PortalGuard\bin folder,rename the existing "LogRotation.exe" to "LogRotation.old"
- Copy the newer LogRotation.exe and LogRotation.exe.config into this folder.
- In the LogRotation.exe.config file, change the "DaysToKeep" value from "30" (as shown below) to the number of days of logs you wish to archive/keep.
- NOTE: This is a "string" value so make sure you do not accidentally delete the double-quotes surround the value!
- Save the changes to that file and close the text editor.
With those steps done, the Log Rotation will automatically occur at 6am tomorrow morning (and the next, and the next...). If you are low on disk space now and want to run the clean up immediately, do the following:
- From the Start button, open Windows Task Scheduler
- In the "Task Scheduler Library" folder, click/select the PortalGuard Log Rotation task (note how it is set to run every morning at 6:00 AM).
- Click the "Run" action on the right-hand side to run it immediately.
- Verify the older log files have been deleted from the following folder: C:\Program Files\PistolStar\PortalGuard\Logs\old
- NOTE: There will be a maximum of 60 log files since each day has separate PG_Log and IdP_Log files!
If you run into any errors or have questions, please email us at email@example.com.
REV. 01/2020 | PortalGuard