SP.
SP.

Reputation: 363

Sentry delete issues (logs)

I'm running Self-Hosted Sentry 21.6.1 on-premise with docker-compose up -d and Django database is getting full very fast because of large number of collected issues. 3,218,732 Total Errors in 8 days.

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       504G  130G  349G  28% /

How can I delete old issues (let's say older than 30 days) from the database or set new issues to overwrite the old ones once the disk is full? Or is there a better solution for this problem?

Upvotes: 5

Views: 4779

Answers (1)

SP.
SP.

Reputation: 363

Found a solution here.

In the Sentry Docker directory, run: docker-compose exec worker bash

After that from the worker bash run: sentry cleanup --days 15

This will clean up all the events' data before 15 days. This took around 5 hours to complete for 500 GB of data. After cleaning, more than half of the data was deleted.

After this, inside the database run:

docker-compose exec postgres bash

psql -U postgres

\c postgres

VACUUM FULL;

This will lock database tables until the full vacuum operation is done! Thanks again to the original post for this solution.

UPDATE: 2 weeks since cleaning I received around 5,000,000 errors and the size of the disk is still around 250 GB as was on the day of cleaning. It looks like the workers are doing real cleanups now.

Upvotes: 11

Related Questions