> Source: https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/ConfigurationWorkPanel/LogDataCleanup/

# Cleanup platform log data

**Log data cleanup** is the only way, from the administration console, to make traces that have already been written disappear. It deletes rows from the [event log](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/Logs/EventLogs/) that are older than a chosen duration, either on demand or on a schedule.

It is therefore the only means of setting a retention period for a CyberElements platform.

![](https://docs.cyberelements.io/saas/img/cyberelements/CYE_AdminConsole_Config_LogDataCleanup_Scheduled.png)

> **Default retention**
>
> The platform sets **no** retention period at installation, and scheduled cleaning is **disabled** by default: nothing is erased without an explicit request. Until somebody opens this module, the event log grows without limit. A retention period required by an internal policy therefore has to be entered here by hand: nothing in the product will pick it up from anywhere else.

## Scope of the purge

Contrary to what its name may suggest, the module does not perform a general clear-out: it works on **two tables**, and ignores everything else.

| Data | Covered by this module |
|---|---|
| Event log | ✅ |
| Workflow history | ✅ through the **Workflow** checkbox |
| Sessions: [user statistics](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/Logs/UserStatistics/) and [licence usage](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/Logs/LicensesUsage/) | ❌ |
| Session recordings (the videos) | ❌ |
| [Raised alert history](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/Alerts/RaisedAlertHistory/) | ❌ |

> **Session data**
>
> Session data cannot be purged anywhere. User statistics and licence usage read the **same** session table, and no console function empties it: neither this module nor any other. Those rows accumulate for the whole lifetime of the tenant. Setting the log's retention therefore does not set the retention of this data.

> **Recording retention**
>
> Recordings have their own retention period, which is set elsewhere. Automatic video deletion is a setting of the **recorded object** (the application, the RDP machine or the SSH server), not of the platform. It is set object by object, and it is **inactive** until it has been ticked. A log purge therefore frees no space on the [Edge Gateway](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/SitesAndGateways/Gateways/) disks.

## Selection of deleted data

The module offers two tabs (**Immediate cleaning** and **Scheduled cleaning**) which share exactly the same selection fieldset. The boxes ticked there determine the **nature** of the rows deleted; the retention field determines their **age**.

Three families of checkboxes combine:

- the **action types** (add, modify, delete) target what administrators did in the console;
- the **session actions** (close, pause, resume, remote connection) target what was done from the Control Center;
- the **information** entries target usage events: console and user portal logins, application launches and closings, gateway and client connections, direct sessions, password actions, help requests, and the workflow history.

Ticking **All** disables the three families: the purge then covers the whole log, within the chosen age window.

> **Combining families**
>
> The families add up, they do not intersect: ticking boxes in two families deletes the rows that belong to **one or the other**. The selection is a union, never an intersection. An **information** checkbox also designates a fixed set of event types decided by the product: the choice bears on a family, not on a free criterion.

## Retention period

The **Keep the last** field takes a number and a unit (days, months or years) and sets the boundary: everything **older** is deleted, everything more recent is preserved. There is no lower bound: the purge goes back to the very first row in the log.

> **Suggested values**
>
> The suggested value is not the same in the two tabs: the immediate tab opens on **2 years**, the scheduled tab on **1 year**. Both are starting values, not a platform setting; an immediate cleaning launched after configuring the schedule therefore does not use the same duration unless the field is corrected.

> **Value 0**
>
> The value 0 is accepted. Keeping "0 days" deletes the log right up to the present moment. The field does not forbid it, and no special confirmation distinguishes it from an ordinary purge.

## VACUUM option

The **PostgreSQL VACUUM** checkbox asks the database to return the space freed by the deleted rows to the system. Deleting rows does not shrink the database file; this operation is what does.

> **Cleaning reduced to VACUUM**
>
> A cleaning reduced to VACUUM deletes no data. The console agrees to launch the operation as soon as **one** box is ticked, including when that single box is **PostgreSQL VACUUM**. With nothing selected for deletion, the purge then removes no row at all: only the compaction takes place. It is a legitimate use (after a large purge, for instance), but it looks like a full cleaning launched by mistake.

If no box is ticked at all, the operation is refused with **Nothing to clean**.

## Immediate cleaning

The tab carries a warning that the product shows in orange: the cleaning may last **several hours** and slow the platform down noticeably. Deletion proceeds in successive batches, and compacting the database is a heavy operation.

While it runs, the form is locked and a cancel button becomes active.

> **Cancellation**
>
> Cancelling stops the job, it does not undo it. Cancellation is taken into account between two batches: what has already been deleted is gone for good. An [export of the log](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/MainWorkPanel/Logs/EventLogs/) taken **before** the purge is the only way to keep the data, and it has to be prepared in advance.

The state of the operation is polled every five seconds, and monitoring resumes if the window is closed and reopened while the job is running.

## Scheduled cleaning

The second tab stores a repeated purge: daily, weekly or monthly, at a given time. It uses its own data selection and its own retention period, independent of those of the immediate tab.

> **Single schedule**
>
> Only one schedule exists at a time. Saving replaces the previous one; there is no way to have two different retention rules (say a yearly purge of logins and a monthly purge of application launches). The same duration applies to everything the selection retains.

If the chosen date and time have already passed when the schedule is saved, the first run is postponed to the next day.

## Usage rights

This module is the only one in the **Configurations** work panel whose permission depends on another: a [delegated administration profile](https://docs.cyberelements.io/saas/et/Usage/Administration/AdminConsole/ConfigurationWorkPanel/DelegatedAdminProfiles/) can only grant cleanup if it also grants **Logs**. The converse also applies, without being stated anywhere: granting **Logs in write mode** opens the cleanup module even if the matching box was never ticked. Purging a log is indeed a write on that log, but the profile screen does not show it.

## Limits

- Two tables only: the event log and the workflow history. Neither sessions, nor videos, nor the alert history.
- One schedule only, therefore one retention period for the whole platform.
- No undo: what is deleted is gone for good, and cancelling a running cleaning restores nothing.
- No preview: the console does not announce how many rows will be deleted before it starts.
- One cleaning at a time per tenant: launching one while a scheduled cleaning is running is refused with a generic error message that does not say why.
- In **Cluster**, scheduled cleaning only runs on the master node; in **Standalone**, on the main server.

---

Field-by-field details are in the [module reference](https://docs.cyberelements.io/saas/et/Usage/AdminConsoleReference/LogDataCleanup/).
