We need to keep just one statistic for a longer time, in particular the used disk space, but all of the rest of the data can be removed after one month.
Setting global retention to 2y works fine, but the amount of storage consumed by the stats db is concerning, and all of the other stats are useless for us beyond 1 month.
I found an article stating I can delete through the admin API, but I am wondering how to write a query for everything except disk usage. I think this query would delete the value I want to retain, so how to swap it to everything but this value? Is there a way to query prior to delete so I can see what it wants to delete?
aged=$(date --date=“30 days ago” +%s)
curl -X POST -g ‘http://localhost:9090/api/v1/admin/tsdb/delete_series?match=zfs_dataset_available_bytes&end=$aged’