Sentry cleanup

Запись создана 2 декабря, 2024

To cleanup self hosted Sentry you can use a following script:

docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE default.spans_local'
docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE default.generic_metric_distributions_aggregated_local'
docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE default.generic_metric_distributions_raw_local'
docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE system.metric_log'
docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE default.transactions_local'
docker exec  -it sentry-self-hosted-clickhouse-1 clickhouse-client -q 'TRUNCATE default.outcomes_raw_local'
docker exec --tty -u postgres sentry-self-hosted-postgres-1 psql -c "TRUNCATE TABLE nodestore_node;"
docker exec --tty -u postgres sentry-self-hosted-postgres-1 psql -c "VACUUM FULL"
docker exec -it sentry-self-hosted-redis-1 redis-cli FLUSHALL

If you want to delete events older than 3 days

docker exec --tty -u postgres sentry-self-hosted-postgres-1 psql -c "DELETE FROM nodestore_node WHERE "timestamp" < NOW()-INTERVAL '3 day';"
docker exec --tty -u postgres sentry-self-hosted-postgres-1 psql -c "vacuum full nodestore_node;"

To cleanup historey older than 7 days

docker exec -it sentry-self-hosted-worker-1 
sentry cleanup --days 7

Some times you can get a problem with terrible grow of Kafka volume, than you can recreate it:

cd /opt/sentry/install/self-hosted-23.7.1/
docker compose down --volumes
docker volume rm sentry-kafka
docker volume rm sentry-zookeeper
./install.sh
docker compose up -d

» Запись из раздела Несортированное | Комментировать

Комментарии





Ответить