---
title: Purge Web GUI logs
description: The purge.sh script either archives or purges processed access log files and admin log files which are stored in the /opt/pingidentity/webgui/logs/access/ and /opt/pingidentity/webgui/logs/admin/ directories respectively.
component: pingintelligence
version: 5.1
page_id: pingintelligence:pingintelligence_dashboard:pingintelligence_purge_webgui_logs
canonical_url: https://docs.pingidentity.com/pingintelligence/5.1/pingintelligence_dashboard/pingintelligence_purge_webgui_logs.html
revdate: April 3, 2024
section_ids:
  external-log-archival: External log archival
---

# Purge Web GUI logs

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

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

Located in the `/opt/pingidentity/webgui/util` directory, the `purge` script deletes logs older than the specified number of days. Run the script using the webgui command line. NOTE: The number of days specified should be between 1-365 days.

For 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
```

**Force delete**: You can force delete the webgui log files by using the `-f` option with the `purge.sh` script. When using this option, the script does not check for confirmation to purge the log files. 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.

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

In the above example, the script force purges the webgui log files while keeping log files of 2-days.

## **External log archival**

The `purge` script can also archive logs older than the specified number of days to secondary storage. Use the `-l` option and include the path of the secondary storage to archive log files. For example.

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

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