Is your feature request related to a problem? Please describe.
On self-hosted instances, the core events ClickHouse table (and its sessions_mv_target rollup) has no TTL — pageview/event data, including the raw ip column, is retained indefinitely by default. By contrast, session_replay_events/session_replay_metadata (30 days) and bot_events/bot_observations (3 months/30 days) already have hard-coded TTLs baked into the schema init code. The only documented way to change retention on the main events data is to hand-write a ClickHouse ALTER TABLE ... MODIFY TTL directly against the database, which most self-hosters won't know to do and isn't discoverable from the app itself.
For orgs with internal data-retention or privacy policies, this means the default self-hosted install silently keeps raw visitor-level event data (including IPs) forever unless someone thinks to go modify ClickHouse TTLs by hand.
Describe the solution you'd like
A configurable retention setting for the events table (and ideally the derived session rollups), e.g.:
- An env var like
EVENTS_RETENTION_DAYS that the schema init step applies as a TTL on events (and sessions_mv_target) at startup, similar to how the existing session-replay/bot tables get their TTL today.
- Optionally, a per-organization/site setting in the admin UI for instances that want different retention per site.
Default should remain none (no TTL — current behavior unchanged) so nothing breaks for existing installs; retention would be strictly opt-in.
Additional context
The managing-your-installation docs currently only cover shortening the session replay TTL via manual ALTER TABLE ... MODIFY TTL commands (https://rybbit.com/docs/managing-your-installation). It would help to have the same lever exposed as a proper config option for the primary events data, since that's the table most likely to carry PII (IP, precise geo, referrer, etc.) and the one with no automatic expiry at all today.
Is your feature request related to a problem? Please describe.
On self-hosted instances, the core
eventsClickHouse table (and itssessions_mv_targetrollup) has no TTL — pageview/event data, including the rawipcolumn, is retained indefinitely by default. By contrast,session_replay_events/session_replay_metadata(30 days) andbot_events/bot_observations(3 months/30 days) already have hard-coded TTLs baked into the schema init code. The only documented way to change retention on the main events data is to hand-write a ClickHouseALTER TABLE ... MODIFY TTLdirectly against the database, which most self-hosters won't know to do and isn't discoverable from the app itself.For orgs with internal data-retention or privacy policies, this means the default self-hosted install silently keeps raw visitor-level event data (including IPs) forever unless someone thinks to go modify ClickHouse TTLs by hand.
Describe the solution you'd like
A configurable retention setting for the
eventstable (and ideally the derived session rollups), e.g.:EVENTS_RETENTION_DAYSthat the schema init step applies as a TTL onevents(andsessions_mv_target) at startup, similar to how the existing session-replay/bot tables get their TTL today.Default should remain none (no TTL — current behavior unchanged) so nothing breaks for existing installs; retention would be strictly opt-in.
Additional context
The managing-your-installation docs currently only cover shortening the session replay TTL via manual
ALTER TABLE ... MODIFY TTLcommands (https://rybbit.com/docs/managing-your-installation). It would help to have the same lever exposed as a proper config option for the primary events data, since that's the table most likely to carry PII (IP, precise geo, referrer, etc.) and the one with no automatic expiry at all today.