---
title: Purging WebGUI logs
description: The purge.sh script either archives or purges processed access log files and admin log files that are stored in the /opt/pingidentity/webgui/logs/access/ and /opt/pingidentity/webgui/logs/admin/ directories respectively.
component: pingintelligence
version: 5.2
page_id: pingintelligence:pingintelligence_reference_guide:pingintelligence_purge_webgui_logs
canonical_url: https://docs.pingidentity.com/pingintelligence/5.2/pingintelligence_reference_guide/pingintelligence_purge_webgui_logs.html
revdate: April 3, 2024
section_ids:
  about-this-task: About this task
  steps: Steps
  example: Example:
  example-2: Example:
  example-3: Example:
---

# Purging WebGUI logs

The `purge.sh` script either archives or purges processed access log files and admin log files that are stored in the `/opt/pingidentity/webgui/logs/access/` and `/opt/pingidentity/webgui/logs/admin/` directories respectively.

## About this task

Located in the `/opt/pingidentity/webgui/util` directory, the `purge` script deletes logs older than the specified number of days.

|   |                                                            |
| - | ---------------------------------------------------------- |
|   | The number of days specified should be between 1-365 days. |

## Steps

1. Run the script using the WebGUI command line.

   ### Example:

   ```
   /opt/pingidentity/webgui/util/purge.sh -d 1
   This will delete the logs in /opt/e2e/pingidentity/webgui/logs/admin and /opt/e2e/pingidentity/webgui/logs/access that are older than 1 days.
   Are you sure (yes/no): yes
   Removing /opt/e2e/pingidentity/webgui/logs/admin/admin.log.2020-04-08 : last changed at Wed Apr  8 17:07:49 UTC 2020
   removing /opt/e2e/pingidentity/webgui/logs/access/access.log.2020-04-08 : last changed at Wed Apr  8 19:03:31 UTC 2020
   Done
   ```

   |   |                                                                                                                                             |
   | - | ------------------------------------------------------------------------------------------------------------------------------------------- |
   |   | When the `purge` script is run, the log files are permanently deleted. Hence it is recommended to always back up the files before deleting. |

2. To force delete the WebGUI files:

   1. Use the `-f` option with the `purge.sh` script.

   When using this option, the script does not check for confirmation to purge the log files.

   1. Use the force purge option with the `-d` option to provide the number of days of logs to keep.

      ### Example:

      The following snippet shows an example of the force purge and `-d` option. In this example, the script force purges the WebGUI log files while keeping log files of 2 days.

      ```
      /opt/pingidentity/webgui/util/purge.sh -d 2 -f
      ```

3. To archive logs older than the specified number of days to secondary storage, use the `-l` option the `purge.sh` script and include the path of the secondary storage to archive log files.

   ### Example:

   In this example, log files older than `2-days` are archived to the `backup` directory. To automate log archival, add the script to a `cron` job.

   ```
   /opt/pingidentity/webgui/util/purge.sh -d 2 -l /backup/
   ```
