← Back to Blog

How Self-Hosted Langfuse Froze My Mac: ClickHouse System Logs, the Hidden Disk Killer

2026-10-23·LangfuseClickHouseDockerSelf-hostingDevOps

When a disk fills up, we often assume the problem is simply too much data.

But what froze my Mac this time was not the data at all.

One day, in the middle of coding, my Mac locked up completely — the cursor would not move, the terminal stopped responding, and I had to force a reboot. The culprit turned out to be the Langfuse instance I self-host on my laptop. More precisely, it was ClickHouse, the database behind it.

My Langfuse data was only 10MB. ClickHouse was taking up 9.5GB.

This article breaks down what happened from hands-on experience — covering the root cause, a safe cleanup process, and four guardrails you should set up front. It is especially useful for developers self-hosting services with Docker, or anyone whose laptop keeps running out of space.

Three Key Players

1. What Happened: A Chain of Dominoes

Disk fills up → every write fails → ClickHouse retries nonstop and floods errors → CPU maxes out → the whole computer freezes

How can one broken container take down an entire computer?

The key is that Docker sets no limits by default. On a Mac, containers actually run inside Docker Desktop's virtual machine (VM), and by default Docker Desktop gives that VM every CPU core you have. Docker's virtual disk can also keep growing until your computer runs out of space.

In other words, nothing stops it.

2. Finding the Culprit: Who Is Using the Space?

Step one is always to measure before you act. Do not delete things on a hunch. Start by checking how much space each part of Docker uses:

bash
docker system df -v

The ClickHouse volume alone took 9.5GB:

VolumeSize
clickhouse_data (ClickHouse data)9.5 GB
clickhouse_logs (ClickHouse log files)204 MB
minio_data (file storage)150 MB
postgres_data (accounts and settings)64 MB

Next, look inside ClickHouse to find the biggest tables. From the folder that holds docker-compose.yml, run this to open ClickHouse's SQL prompt (the username and password are CLICKHOUSE_USER and CLICKHOUSE_PASSWORD in your .env):

bash
docker compose exec clickhouse clickhouse-client --user clickhouse --password your-password

Then run this query:

sql
SELECT database, table,
       formatReadableSize(sum(bytes_on_disk)) AS size
FROM system.parts
WHERE active
GROUP BY database, table
ORDER BY sum(bytes_on_disk) DESC
LIMIT 10;
TableSizeWhat it is
system.trace_log5.77 GiBPerformance samples ClickHouse takes of itself (trace sampling)
system.text_log2.25 GiBClickHouse's own activity log
system.part_log524 MiBRecords of internal housekeeping (merges and moves)
system.metric_log161 MiBA snapshot of system metrics every second
default.events_full9.36 MiB👉 The actual Langfuse data

Mystery solved: the real Langfuse data was only 10MB. The other 9.4GB was diagnostic records ClickHouse writes for itself (system log tables).

3. Why It Happens: A Camera That Never Records Over Old Footage

Think of ClickHouse's diagnostic records as a security camera that never overwrites old footage:

These records are debugging tools designed for database administrators running production systems. When you are developing on a laptop, you almost never need them — yet they quietly eat your disk every day.

Here is the trap: Langfuse's official docker-compose.yml uses ClickHouse's default settings as-is. The moment you follow the official docs and run docker compose up, the time bomb starts ticking.

This was actually my second time getting bitten by disk space. The first time, the ClickHouse container's log grew to 33GB — ClickHouse logs at the most verbose trace level by default, once the disk was full every failed write printed yet another error, and Docker does not cap container log size by default either. I capped the logs, thought I was done, and never realized another pile of records was hiding inside the database.

4. Safe Cleanup: Getting the Space Back

Tables whose names start with system are only diagnostic records. Deleting them does not affect any Langfuse feature, and ClickHouse recreates them when it needs them.

⚠️ Two things to watch before you start:

sql
DROP TABLE IF EXISTS system.trace_log SYNC;
DROP TABLE IF EXISTS system.text_log SYNC;
DROP TABLE IF EXISTS system.part_log SYNC;
DROP TABLE IF EXISTS system.metric_log SYNC;
-- and the same for the other system.*_log tables

Afterwards, list the log tables in system again to make sure nothing slipped through. When ClickHouse sees that a log table's settings have changed, it renames the old table to xxx_log_0, xxx_log_1, and so on, then creates a fresh one. Those old copies have no expiry and never go away on their own, so DROP them too:

sql
SELECT name FROM system.tables
WHERE database = 'system' AND name LIKE '%_log%';

Then clear out old Docker images and build cache you no longer use:

bash
docker image prune -a -f   # delete images no container uses
docker builder prune -f    # delete unused build cache
⚠️ image prune -a keeps only images that a container uses, and stopped containers count. But if you just ran docker compose down, those containers are gone, so the Langfuse images get deleted too and will be downloaded again (about 2.5GB) on the next start.

Before and after:

ItemBeforeAfter
ClickHouse data9.5 GB18 MB
ClickHouse log files204 MB4 KB
Old images + build cache—~9.5 GB reclaimed
Free space on my computer15 GB28 GB

5. Prevention: Four Guardrails So It Never Happens Again

Cleanup only treats the symptom. The real goal: even if a service runs away again, only one container breaks — not your whole computer.

All of these settings go in docker-compose.override.yml. This file layers on top of the official config, so you never edit the official file, and future Langfuse upgrades are less likely to conflict.

Guardrail #1: System Log TTL — Give Diagnostic Records an Expiry Date

Turn off the records you do not need, and keep the rest for only 3 days. TTL (Time To Live) is simply an expiry date for data — once it passes, the data is deleted automatically:

xml
<clickhouse>
    <!-- Not needed for local development -->
    <trace_log remove="1"/>
    <text_log remove="1"/>
    <!-- Keep everything else for 3 days -->
    <part_log><ttl>event_date + INTERVAL 3 DAY DELETE</ttl></part_log>
    <metric_log><ttl>event_date + INTERVAL 3 DAY DELETE</ttl></metric_log>
    <query_log><ttl>event_date + INTERVAL 3 DAY DELETE</ttl></query_log>
    <!-- ... -->
</clickhouse>

Save it as clickhouse/system_logs.xml and mount it into the container from docker-compose.override.yml. The logger.xml and disk.xml files below are mounted the same way:

yaml
services:
  clickhouse:
    volumes:
      - ./clickhouse/system_logs.xml:/etc/clickhouse-server/config.d/z_system_logs.xml:ro
      - ./clickhouse/logger.xml:/etc/clickhouse-server/config.d/z_logger.xml:ro
      - ./clickhouse/disk.xml:/etc/clickhouse-server/config.d/z_disk.xml:ro

The z_ prefix makes these files load last so they override the defaults. Then run docker compose up -d, and Docker recreates the container with the new settings.

Two gotchas I ran into:

💡 Insight: TTL only applies when a table is created — after changing the config, always drop the old tables.

Guardrail #2: Log Rotation — Cap Log File Sizes

Docker's container logs have no limit by default, and ClickHouse's own log files are large by default too, so cap both. Once a log hits its limit, it rotates and the oldest file is deleted.

The Docker side (up to 10MB per file, at most 3 files):

yaml
x-logging: &default-logging
  driver: json-file
  options:
    max-size: "10m"
    max-file: "3"

services:
  clickhouse:
    logging: *default-logging

The ClickHouse side (warnings and above only, up to 100MB per file, at most 3 files):

xml
<clickhouse>
    <logger>
        <level>warning</level>
        <size>100M</size>
        <count>3</count>
    </logger>
</clickhouse>

Guardrail #3: Reserved Disk Space — Stop Before Hitting Zero

Stop writing when 2GB is left, instead of waiting until the disk is completely full. It is like refueling when the low-fuel light comes on, instead of driving until the car dies in the middle of the road:

xml
<clickhouse>
    <storage_configuration>
        <disks>
            <default>
                <!-- 2GB = 2147483648 bytes -->
                <keep_free_space_bytes>2147483648</keep_free_space_bytes>
            </default>
        </disks>
    </storage_configuration>
</clickhouse>

With this in place, ClickHouse refuses to write data and reports an error when space runs low, which makes a retry storm far less likely.

This guardrail has two limits, though:

So it only truly works together with the Docker Desktop disk limit below.

Guardrail #4: CPU Limits — Cap Every Container

Many people set only a memory limit (mem_limit), but a memory limit does nothing for CPU. My computer has 8 cores. All containers together get at most 6.5, so even if everything runs away, 1.5 cores are still left for the computer itself:

yaml
services:
  clickhouse:
    mem_limit: 2g
    cpus: 2        # at most 2 cores
  langfuse-web:
    mem_limit: 1536m
    cpus: 1.5
  langfuse-worker:
    mem_limit: 896m
    cpus: 1

If you would rather not set this per container, Docker Desktop's Settings → Resources also lets you cap how many CPU cores the whole VM gets. Then nothing running inside it can touch the cores you reserved for your computer.

Bonus: Docker Desktop's Disk Limit

The last setting has to be changed by hand in Docker Desktop: Settings → Resources → Advanced → Disk usage limit

My Docker disk limit was 58GB, but my computer had only 28GB free at the time. That means Docker would not think it was full until it had already eaten my whole disk. Set the limit below your computer's free space, and no matter how much Docker grows, it cannot take your computer down — it is also what makes the reserved space in Guardrail #3 actually work.

⚠️ Back up any important volumes before lowering the limit. Some Docker Desktop versions recreate the virtual disk when you resize it, which can wipe your containers and data.

A common beginner question: I deleted several GB inside Docker, so why did my Mac get back so much less? Docker keeps everything in a single virtual disk file, and that file does not always shrink right away when things inside it are deleted. I cleared 5.8GB of build cache and my Mac gained only about 2GB. Restarting Docker Desktop usually lets it hand the space back.

6. Running Out of Space? Start Here

If you found this article because your computer is almost full, these commands only delete caches that can be rebuilt, so they are safe to run first:

bash
df -h /                       # how much space is left
docker system df              # how much Docker is using
docker builder prune -af      # Docker build cache, usually the biggest chunk
brew cleanup -s --prune=all   # Homebrew cache
npm cache clean --force       # npm cache
pip3 cache purge              # pip cache

To sweep browser, app, and developer-tool caches in one go, try the open-source tool Mole (brew install mole). Run mo clean --dry-run first to preview what it would delete, and only run the real cleanup once you are happy with the list.

7. Turn the Fix into a Skill: Next Time Takes One Sentence

Running out of disk space is not a one-time event, but looking up the commands again and remembering what is safe to delete takes time every time. So once this was fixed, I asked Claude Code to turn the whole troubleshooting process into a Skill.

A Skill is a playbook written for the AI (SKILL.md), stored under ~/.claude/skills/. From then on, whenever I say "my disk is full" or "I am running out of space," Claude Code loads it automatically and follows the same steps — no need to explain everything from scratch.

markdown
---
name: mac-disk-cleanup
description: Troubleshoot and reclaim disk space on macOS, using Mole when
  useful. Trigger when the user says "disk full", "out of space", or
  "clear caches".
---

# Mac Disk Space Troubleshooting
Rules: measure before deleting, dry-run before running, never touch user data.

## 1. Measure first (read-only commands)
## 2. Low-risk quick wins (each tool's own cache-clean command)
## 3. Mole: preview, set the whitelist, then run
## 4. Big items the user must decide on
## 5. Known pitfalls (ones I actually hit)

The most valuable part is section 5, which records every pitfall from this round, for example:

💡 Insight: You usually learn details like these only by getting burned once. Written into a Skill, they never burn you twice. If you use AI tools for recurring maintenance chores, turn each fix into a Skill right after you solve it.

8. Self-Hosting Checklist for Beginners

This is not just about Langfuse. Whenever you self-host anything with Docker (especially a database), check these on day one:

What to checkWhy it mattersHow
Container log sizeNo limit by default; can grow to tens of GBSet max-size / max-file
The service's own recordsDatabases often keep internal records they never deleteTurn them off or set an expiry (TTL)
Reserved disk spaceFailing only at zero can trigger a retry storme.g. keep_free_space_bytes
CPU limitsA memory limit does not cover CPUSet cpus for each service
Docker disk limitDocker can grow until your computer is fullDocker Desktop → Resources → Advanced
Check usage regularlyProblems usually grow silently for weeksdocker system df -v

💡 Takeaways

Getting a service running by following the official docs is only the first step of self-hosting.

Default settings are designed for administrators running production systems — not for those of us developing on a laptop.

What lets a service run safely for the long term is knowing where it quietly piles things up, and setting a limit for every way it can run away. Then, the next time something breaks, you lose one container — not your whole computer.

Has a self-hosted service ever eaten your disk? Drop a comment below — I'd love to hear your story! 😊


← Back to BlogNext: 自架 Langfuse 塞爆整台 Mac:ClickHous… →