Version Affected: All
How to use Remove-SALogFiles to delete all Audit, Debug and Error text logs over a specific age
Log files can over time consume a large amount of storage. Clearing down old log files that are no longer necessary is good practice and will help speed up backups and reduce their size.
Download Remove-SALogFiles from here:
- After downloading be sure to right click the script, click Properties, then Unblock (if present).
- The script can be run from any folder on the IdP.
- Help on usage and examples can be obtained by running:
Here's a brief summary of the syntax and some examples:
[-WebconfigFolder <String>] [-All] [-AuditLogs] [-DebugLogs] [-ErrorLogs] [-Confirm]
[-OlderThan <Int32>] [-WhatIf] [<CommonParameters>]
Remove-SALogFiles -DebugLogs -OlderThan 14
# Will delete all debug logs older than 14 days.
Remove-SALogFiles -All -OlderThan 3 -Confirm
# Will delete all logs older than 3 days without asking for confirmation.
Remove-SALogFiles -AuditLogs -ErrorLogs -OlderThan 30
# Will delete Audit and Error logs older than 30 days.
Remove-SALogFiles -AuditLogs -ErrorLogs -OlderThan 30 -WhatIf
# Will show which Audit and Error logs older than 30 days would have been deleted.
- The -WhatIf switch prevents any files from being deleted even if used in conjunction with the -Confirm switch or answering "Y" to the confirmation.
- Use the -OlderThan switch to only delete log files older than X days. Defaults to 7 days if omitted. Minimum is 1 day.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Please sign in to leave a comment.