How to clear old logs from the SQL Reporting Database

    Applies to:
  • Legacy SecureAuth IdP
Deployment model:
  • On Premises
  • Version Affected:  All


    By default, when you setup the SQL Reporting Database, it keeps the logs forever. 

    This article provides a SQL Query that will cleanly delete all records over 30 days old


    Standard Behaviour



    1. Log into SQL Management Studio
    2. Click New Query
    3. Change the Database to your logging database
    4. Run

    Delete from CategoryLog where Logid in (Select Logid from Log where Timestamp <= dateadd(day, -30,getdate()));
    Delete from Log where LogID not in (select logid from CategoryLog);



    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



    Please sign in to leave a comment.