Skip to content

SENTRY_EVENT_RETENTION_DAYS is not being respected #3850

@Spikatrix

Description

@Spikatrix

Self-Hosted Version

25.7.0

CPU Architecture

x86_64

Docker Version

28.3.3

Docker Compose Version

2.39.1

Machine Specification

  • My system meets the minimum system requirements of Sentry

Steps to Reproduce

  • I had SENTRY_EVENT_RETENTION_DAYS set to 360 in my .env
  • Updated it to 730.
  • Ran docker compose down and then docker compose up -d
  • Transactions older than 360 days still gets deleted :(

Tried the following too but it did not fix the issue:

  • Ran ./install.sh after updating .env
  • Upgraded sentry to 25.7.0

Expected Result

Transactions older than 360 days are retained and those older than 730 days are deleted.

Actual Result

Transactions older than 360 days gets deleted.

$ cat .env | grep RETENTION
SENTRY_EVENT_RETENTION_DAYS=730

$ docker inspect sentry-self-hosted-sentry-cleanup-1
…
"Cmd": [
  "0 0 * * * gosu sentry sentry cleanup --days 730"
],
…

$ docker inspect sentry-self-hosted-vroom-cleanup-1
…
"Env": [
  "SENTRY_EVENT_RETENTION_DAYS=730",
  …
],
"Cmd": [
  "0 0 * * * find /var/vroom/sentry-profiles -type f -mtime +730 -delete"
],
…

$ docker inspect sentry-self-hosted-symbolicator-cleanup-1
…
"Cmd": [
  "55 23 * * * gosu symbolicator symbolicator cleanup"
],
…

$ cat sentry/sentry.conf.py     # I use pretty much the default sentry.conf.example.py
…
# Sentry event retention days specifies how long events are retained in the database.
# This should be set on your `.env` or `.env.custom` file, instead of modifying
# the value here.
# NOTE: The longer the days, the more disk space is required.
SENTRY_OPTIONS["system.event-retention-days"] = int(
    env("SENTRY_EVENT_RETENTION_DAYS", "90")
)
…

Event ID

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions