Skip to content
AI GatewayAI Gateway Manual

Log retention

Set the one retention period, 10 to 1825 days, that applies to Model Logs and MCP Logs, what a deletion keeps and removes, and how the hourly cleanup behaves.

Every model request and every audited MCP request adds a log to the database, and the tables grow with traffic until the disk fills. A full disk stops the whole Gateway, including sign-in. Log retention is always on: it deletes logs older than the retention period so the disk stays bounded. You cannot turn it off, so logs cannot be kept forever. It protects disk space. It is not a compliance control, because a log can outlive its period by up to one cleanup interval.

In the administrator console, open System → Log retention (/admin/log-retention). Only organization administrators (org-admin, permission log-retention.manage) can change the setting. Users with Organization audit access can open the page and see the current period, but the day field is disabled and Save and Revert do not appear.

The page has one section for the retention period. It applies to both Model Logs (LLM Logs) and MCP Logs. There is no switch.

The day field set to 14, with Save enabled. Callout 1 is the retention period field and callout 2 is the Save button

The screen above shows 14 entered in the field, so Save is enabled. Callout 1 is the Retention period field and callout 2 is the Save button. When you first open the page, the field holds the stored value (30 days) and Revert and Save are disabled.

SettingMeaning
Retention periodA whole number of days from 10 to 1825 (5 years). Any other value shows an error on the field and Save stays disabled.

The default is 30 days, including after an upgrade, so cleanup runs without any action from you. The status message names the stored period, for example that Model Logs and MCP Logs older than 30 days are deleted automatically. The section also summarizes, for each log type, what deletion removes and keeps (see What deletion keeps and removes).

Select Save (callout 2) to apply the period. Revert restores the stored value. Both stay disabled until the day field differs from the stored period. If saving fails, your edited value stays on the page so you can try again.

Lowering the period opens Shorten the retention period?. The dialog names the new period, states that Model Logs and MCP Logs older than it are deleted at the next cleanup, and states that deleted logs cannot be restored. In the screen below, select Shorten and save (callout 1) to save, or Cancel to leave the stored setting unchanged. Lengthening the period saves without a dialog.

The Shorten the retention period? dialog after lowering the period to 14 days and selecting Save. Callout 1 is the Shorten and save button

A background job on the server runs when the server starts and then every hour. You can change the interval with the LOG_RETENTION_INTERVAL server setting. The default is 1h.

  • It deletes whole logs older than the period, oldest first, in small batches. Only one server at a time works on a given log type, so replicas do not collide.
  • A log can outlive its period by up to one interval. A change you save applies from the next run.
  • If a run fails, it is logged and retried at the next interval. The Gateway keeps running.

Hourly usage and cost on the dashboard are built from Model Logs by an hourly rollup. Cleanup never deletes a Model Log that this rollup has not processed yet. That includes the period after an upgrade, while the rollup is still filling in past hours. If the rollup is delayed or backfilling, Model Logs are kept until it catches up, and the next run then removes them.

MCP Logs do not depend on the rollup. They are deleted on schedule even while the rollup lags or backfills.

DataAfter the logs are deleted
Hourly usage and cost on the dashboardKept.
DLP scan results and scoresKept.
Activity Logs of administrator changesKept. They are never deleted.
Log lists and log detailsGone for logs older than the period.
Analytics finer than one hourCover only the retained period.
MCP analyticsCover only the retained period. MCP has no hourly rollup, so nothing remains of deleted MCP Logs.
DLP scan textGone with its log. The DLP console shows the scan text as unavailable.

Deleted logs cannot be restored. A DLP scan that is still running when its target logs are deleted skips those logs and finishes, so its processed count can end below its target count.

Saving a changed setting adds an entry to Activity Logs. Saving without a change adds none.

Deleting rows does not shrink the database files on disk. See Reclaim disk space after log retention.