Clean Sentry On-Premise Database
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!!!
WHY??
Apparently we needed to clear the database after certain time. Otherwise it will stack up all of the error logs.
Solution??
We log into our server. Sentry was running in docker. We went to the docker folder ran thisdocker-compose exec worker bash
After that from the worker bash we ransentry 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
VACUUM FULL;
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 dev.to