How To: Bulk-Delete Old SecureAuth Log Files

Follow
    Applies to:
  • SecureAuth Identity Platform
Deployment model:
  • Cloud
  • Hybrid
  • On Premises
  • Version Affected: All

     

    Overview

    Remove-SALogFiles.ps1 deletes Audit, Debug, and/or Error text logs older than a specified age. Clearing out old log files that are no longer needed is good practice — it helps keep backups faster and smaller.

    1. Download the script here.
    2. After downloading, right-click the script, click Properties, then click Unblock if that option is present.
    3. The script can be run from any folder on the IdP.
    4. For usage help and examples, run:
      Remove-SALogFiles.ps1 -help

    Syntax:

    Remove-SALogFiles.ps1
    [-WebconfigFolder <String>] [-All] [-AuditLogs] [-DebugLogs] [-ErrorLogs] [-Confirm]
    [-OlderThan <Int32>] [-WhatIf] [<CommonParameters>]

    Examples:

    # Deletes all debug logs older than 14 days.
    Remove-SALogFiles -DebugLogs -OlderThan 14
    
    # Deletes all logs older than 3 days without asking for confirmation.
    Remove-SALogFiles -All -OlderThan 3 -Confirm
    
    # Deletes Audit and Error logs older than 30 days.
    Remove-SALogFiles -AuditLogs -ErrorLogs -OlderThan 30
    
    # Shows which Audit and Error logs older than 30 days would be deleted, without deleting them.
    Remove-SALogFiles -AuditLogs -ErrorLogs -OlderThan 30 -WhatIf

    -WhatIf prevents any files from being deleted, even if combined with -Confirm or answering Y to the confirmation prompt. Use -OlderThan to only delete log files older than a given number of days — it defaults to 7 days if omitted, and the minimum is 1 day.

     

    Special Considerations:

    Related articles: How To: Configure Local Text Logging Timestamp, Rollover, and Retention and Troubleshooting: What Logs/Files Can Be Cleaned From a SecureAuth IdP Server?


     

    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.

    0 out of 0 found this helpful

    Comments

    0 comments

    Please sign in to leave a comment.