r/redhat • • 17d ago

Follow-up: I built the "Linux time travel" tool I asked about here. Looking for people to try it

About a month ago I asked here if a tool to see ps, ss or lsof output at a past moment was worth building:

https://www.reddit.com/r/redhat/comments/1wyzyeu/im_thinking_in_building_a_linux_time_travel_tool/

I got some fair pushback (sar, atop, below, Prometheus, zabbix) and a few people who were curious. I looked at all of them. They cover a lot, but none of them could tell me which process had which connections open, or what lsof showed for a process at 02:45 last night. So I built it, mostly to find out if it could be done without hurting the server.

I wanted to name it "command line time travel" but then a though about the consequences of such a name and It's called clifr instead (command line flight recorder) and has two parts:

  • clifrd runs as a service and records processes, process starts and exits (through eBPF, so a process that lives 5 ms still shows up), TCP connections with the process that owns them, files held open, mounts, kernel messages and the usual system counters. It keeps 72 hours in /var/lib/clifr, 2 GB max.
  • clifr rebuilds the output of the normal commands for a past moment or a time range. It doesn't run the command, it rebuilds the output from the recording:
    • clifr --at "02:45" "ps aux"
    • clifr --since "02:00" --until "03:00" "ss -tanp dst10.0.4.21and dport = :5432"
    • clifr --since "1 hour ago" events # starts, exits, OOM kills, mounts
    • clifr diff --at "14:00" --at "14:20" "ss -ltnp"

There are about 40 commands so far: ps, top, pidstat, lsof, ss, netstat, free, vmstat, iostat, mpstat, df, ip, dmesg, systemctl list-units, lsblk, and more and all are 100% accurate.

The first thing people asked last time was the cost, so here are the numbers:

  ┌───────────┬─────────────────────┬─────────────────────────┬─────────────────────────┐
  │           │    Quiet server     │ Mixed load (4-day soak) │ Busy server (benchmark) │
  ├───────────┼─────────────────────┼─────────────────────────┼─────────────────────────┤
  │ CPU       │ 0.35% of one core   │ 0.5-0.6% of one core    │ 1.9% of one core        │
  ├───────────┼─────────────────────┼─────────────────────────┼─────────────────────────┤
  │ RAM       │ ~90 MiB             │ ~80-120 MiB             │ ~290 MiB (335 max)      │
  ├───────────┼─────────────────────┼─────────────────────────┼─────────────────────────┤ 
  │ Disk kept │ ~20 MiB/day         │ ~100 MiB/day            │ ~4 GiB/day              │
  ├───────────┼─────────────────────┼─────────────────────────┼─────────────────────────┤
  │ Network   │ none, no ports open │ none                    │ none                    │
  └───────────┴─────────────────────┴─────────────────────────┴─────────────────────────┘

Disk use depends heavily on how busy the server is.

clifr is not a monitoring tool and has no alerts. It's not a security audit tool either: it doesn't record file reads or writes, and root can stop it. It's for the "what was going on at 02:45" question, after the fact.

Status: it's a prototype, version 0.1.0. It hasn't run on a real production server yet (a friend starts one this week), and all the load has been synthetic. AGPL-3.0, no telemetry, nothing leaves the box.

So if you have a test or dev box (RHEL 8/9, Rocky, Alma), I'd really appreciate it if you tried it and told me what breaks or what looks wrong. The most useful thing for me is comparing what clifr shows with what you know was really happening.

curl -LO https://github.com/jlruedab/clifr/releases/download/v0.1.0/clifrd-0.1.0-1.x86_64.rpm

curl -LO https://github.com/jlruedab/clifr/releases/download/v0.1.0/clifr-0.1.0-1.x86_64.rpm

sudo dnf install ./clifrd-0.1.0-1.x86_64.rpm ./clifr-0.1.0-1.x86_64.rpm

sudo systemctl enable --now clifrd

# wait a few minutes, then:
clifr --at "5 minutes ago" "ps aux"

Repo, with an install guide, a user guide with use cases, and all the benchmark numbers:

https://github.com/jlruedab/clifr

And thanks to everyone who commented on the first post, including the harsh ones. It made this better.

17 Upvotes

7 comments sorted by

2

u/Runnergeek Red Hat Employee 16d ago edited 16d ago

0

u/jlrueda 16d ago edited 16d ago

Thanks for the link. I did the search, and Google's first answer makes my point quite well: Prometheus doesn't track open sockets per process out of the box. That isn't a flaw in Prometheus. It's a metrics system, and it's very good at what it was built for: numbers over time, dashboards and alerts. clifr was built for a different purpose: to let th euser know what exactly was running on this machine at 03:12 last night, who started it, and what it held open.

A few points on why I didn't build this on Prometheus:

  1. Different data. Prometheus stores numbers with labels. Whole-system state is mostly not numbers. It's the process list with command lines and parents, every connection with its addresses and owning process, open files, mounts, units, and processes that lived for 200 ms between two scrapes. clifr records those as events (exec, exit, TCP state changes via eBPF) and periodic snapshots. Afterwards you get the same output ps, top, ss, lsof, pstree and free would have printed at that moment, or over a time range.
  2. Doing it with Prometheus would be hard and expensive. You would need a per-process exporter plus a socket exporter. Then every PID, command line and connection becomes a label, and those labels change constantly. That's the classic high-cardinality problem: millions of short-lived series, which the Prometheus docs themselves warn against. Even then a 15 s scrape never sees short-lived processes, and you can't rebuild ss -tanp or lsof from metrics.
  3. Not everyone runs Prometheus. Plenty of RHEL boxes out there have no monitoring stack at all, or one the sysadmin doesn't control. When something happens there, the usual tools are a sosreport and whatever sar kept.
  4. No other system needed. clifr is one daemon writing local Parquet files and one CLI to query them. No server, no exporter, no network port opened by default. If you need the data elsewhere, you copy a bundle file, or the sos plugin includes it in the sosreport. If you do run Prometheus, clifrd can optionally expose its own metrics with node_exporter names, so the two can work together. Prometheus tells you when something went wrong, and clifr tells you what the machine looked like at that moment.
  5. Disk is bounded by design. Prometheus itself compresses samples well. The problem is the label explosion above. clifr's default is 72 hours of history with a hard 2 GB cap. On a normal server or desktop that's about 20 MiB a day. On a deliberately busy benchmark (80,000 PostgreSQL transactions a second with constant process and connection churn) it's about 4 GB a day, so the cap keeps less history there. CPU is about 0.35% of one core on a normal machine and about 2% under that heavy load. All measured and published in the README, with the method.
  6. Integrity and recovery. Every file clifr writes is recorded with its SHA-256, and clifr verify --integrity checks the recording against it. Optionally the log can be sealed with a forward-secure HMAC chain whose verification key never stays on the host. Someone who gets root later can delete the data, but can't quietly rewrite what was recorded before. After a crash it recovers on the next start, and it picks up the previous boot's kernel panic records from pstore. It opens no port and sends nothing anywhere by default, never reads process environments, and can redact command lines before storing them. To be clear, it's not a replacement for auditd: it doesn't record file reads or writes or logins. It's a record of system state you can check hasn't been altered.

It's a working prototype with honest limits, also listed in the README. If you try it and find something wrong, I'd genuinely like to hear about it.

On calling it trash: I understand the reaction. Subreddits get a lot of low-effort projects, and filtering them is fair. But slop is something nobody tested or measured. This has published benchmarks with the method and raw numbers, a ground-truth test that compares its output with the real tools, packages tested on RHEL 8, RHEL 9 and Ubuntu, and a limitations section that says plainly what it can't do. You can disagree with the approach, and I'd welcome that. But dismissing a post without opening it doesn't only affect me. It tells everyone else here that sharing work for feedback gets a sneer instead of a review, and the people who stop posting are usually the careful ones, not the spammers. r/redhat is useful because people take the time to look before they judge. If you do look and find something wrong, point me to it and I'll fix it or say why not.

2

u/Runnergeek Red Hat Employee 16d ago edited 16d ago

You couldn’t even be bothered to write a reply yourself? You had to use AI to respond (with incorrect and incoherent info)

0

u/jlrueda 16d ago

Yes, I used AI to help me write it, the same way I'd use a spell checker or ask a colleague to read a draft before posting. The content and the numbers are mine, and they're in the repo for anyone to check. If something in it is incorrect, tell me which part and I'll correct it or explain. Otherwise I think we'll have to agree to disagree, and I'll leave it there.

2

u/Runnergeek Red Hat Employee 16d ago

I’m not going to proof read your ai slop. This is embarrassing

3

u/Raz_McC Red Hat Employee 17d ago

Didn't want to call it 'black box'? 🤣 I'll give it a crack on my home server, then try a few thing out!

1

u/jlrueda 15d ago

Please let me know how it went and if you find it useful. Thanks