Preventing storage to balloon #680
-
I am self-hosting Plausible (great app, by the way!!!) on a server with a few other low-usage apps, and today one of them started misbehaving. As I began to look into the issue, I found out that it was because I ran out of disk space, primarily caused by Clickhouse. I understand the need for Clickhouse, as it's an OLAP database that you use to generate analytics from. But is there a way to prevent that from keeping all the history, forever, and ballooning in disk space? Some way to automatically prune old data and keep the most-recent logs only? I understand that you run the SaaS service on a large infrastructure, but I assume that sooner or later you'd be facing issues like these too? -- EDIT |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
At least with the official Docker image, it seems that Clickhouse's query logs are stored in Clickhouse itself, not just in .log files. By running the truncate query in the linked blog post ( I ensured that the log tables won't fill up again by using the config files in that post, too. With docker-compose that might look something like this:
|
Beta Was this translation helpful? Give feedback.
At least with the official Docker image, it seems that Clickhouse's query logs are stored in Clickhouse itself, not just in .log files. By running the truncate query in the linked blog post (
clickhouse-client -q "SELECT name FROM system.tables WHERE name LIKE '%log%';" | xargs -I{} clickhouse-client -q "TRUNCATE TABLE system.{};"
), I reduced my Clickhouse disk usage from about 26GB to 440kB (!)I ensured that the log tables won't fill up again by using the config files in that post, too. With docker-compose that might look something like this: