Clean Sentry On-Premise Database

Clean Sentry On-Premise Database
Photo by No Revisions / Unsplash

So we track our error logs via Sentry on-premises which we hosted on our own. Recently it started to give error, the disk space is running out!!!


Apparently we needed to clear the database after certain time. Otherwise it will stack up all of the error logs.


We log into our server. Sentry was running in docker. We went to the docker folder ran this
docker-compose exec worker bash
After that from the worker bash we ran
sentry cleanup --days 30
basically this will clean up all the events data before 30 days.

After this we go inside of the database by running these

  • docker-compose exec postgres bash
  • psql -U postgres

Point to be noted, VACUUM FULL; will lock your db tables unless the full vacuum is being done.

Voila! Database and hard driver storage cleaned up! :)

Initially written here in

Subscribe to nixon1333

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]