Cleanup Storage
Recording storage
Section titled Recording storageEach recording exists in the form of a file and an entry in the database. OpenReplay dumps what’s necessary to replay a session (DOM mutations, mouse coordinates, console logs, network activity and much more) into a single file. These files are by default stored on your instance, so they make up most of its storage.
Session metadata will be stored in the PostgreSQL database forever, but after 180 days the file containing the recording will be expired/deleted through a minio lifecycle policy.
Change default lifecycle policy
Section titled Change default lifecycle policyYou can change the default lifecycle policy this way:
- Run
k9s -n db
- Use the keyboard arrows to navigate the list and get to the
minio-*
container - Press
s
to have shell access the Minio (object storage) container - Run
mc alias set minio http://localhost:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
- Run
mc ilm set --id mobs --expiry-days 14 minio/mobs
(i.e. automatically clean recordings 14 days after creation) - Use
exit
to exit the Minio container - Run
:quit
to exit the Kubernetes CLI
Manual cleanup
Section titled Manual cleanupDatabase (PostgeSQL)
Section titled Database (PostgeSQL)Use the below SQL query if you wish to cleanup data from your database (PostgreSQL). Replace the epoch timestamp (milliseconds)
with the date from which to keep recordings. It’s a cascade delete, so all recordings as well as their corresponding events will be removed from the database.
Important: This is done at your own risk, so be extremely careful when performing such actions in the database.
--- Cascade delete all sessions and their related events captured before Jan 1st, 2021
DELETE FROM public.sessions WHERE start_ts < 1609459200000;
How to connect to PostgreSQL
Section titled How to connect to PostgreSQLLogin to your OpenReplay instance, then:
- Run
k9s -n db
- Use the keyboard arrows to navigate the list and get to the
postgresql-*
container - Press
s
to have shell access the the Postgres container - Run
PGPASSWORD=MY_PG_PASSWORD psql -U postgres
(replaceMY_PG_PASSWORD
with the value of thepostgresqlPassword
variable from/openreplay/scripts/helmcharts/vars.yaml
file) - Execute your delete (or any other) query
- Type
exit
to exit the postgresql-client - Use
exit
to exit the Postgres container - Run
:quit
to exit the Kubernetes CLI
Recordings
Section titled RecordingsRemove recordings
Section titled Remove recordingsIf you ever need to free up some space, then login to your OpenReplay instance and follow the below steps:
- Run
k9s -n db
- Use the keyboard arrows to navigate the list and get to the
minio-*
container - Press
s
to have shell access the Minio (object storage) container - Run
mc alias set minio http://localhost:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
- Run
mc rm --recursive --dangerous --force --older-than 7d minio/mobs
(i.e. delete files that are older than 7 days) - Use
exit
to exit the Minio container - Run
:quit
to exit the Kubernetes CLI