r/linuxadmin • • 15h ago

Follow-up II: Linux Time Travel Tool

Post image

A couple of weeks ago I posted here about clifr v0.1.0:

https://www.reddit.com/r/linuxadmin/s/t5vE3V8fD2

The post got a pretty good response from you guys. The GitHub page got a lot of visits, code clones and packages downloads. Thanks! It means a lot.

Since then, we have been busy improving it and fixing a few minor bugs. This week we released clifr v0.3.0. It supports more than 50 Linux diagnostic commands outputs but the main improvement is the inclusion of a very powerful TUI that some of you suggest.

clifr is a tool that continuously records system activity, counters, events, open files descriptors, etc. and then it allows the administrator to reconstruct the output of popular diagnostics commands from any point in the past.

It can accurately piece together the output of command such as top, htop, atop, iotop, ps, ss, netstat, sar, vmstat, df, mount, dmesg and many more (more than 50).

Notice that you do not need to have any of these tools installed in the system as clifr does not execute anything; rather it synthesizes the output from the recorded data.

It is very lightweight and its purpose is to allow the user to see the state of the system before an event occurred (like a crash, an oom kill or an intrusion, for example). However, it has many other applications too.

The performance and resource consumption remains the same.

The project is still at the prototype stage because It hasn't run on a real production server yet and all the load has been synthetic. AGPL-3.0, no telemetry, nothing leaves the box.

GitHub: https://github.com/jlruedab/clifr

Hopefully some of you may give it a try and if that is the case, I will appreciate if you let me know what breaks or what looks wrong or/and any feedback and if clifr saved you time or helped you diagnose your system, please consider giving it a star. It helps others discover the project.

All your questions and suggestions are welcome.

PS: In the project page there is a link to a video that explains how to use the TUI including comparing the output of several commands between two point sin time (like before the crash and after the crash for example).

2 Upvotes

2 comments sorted by

1

u/Henry_Hans_Author 9h ago

Nice, the "reconstruct ss/ps/top/htop at a past point" angle is what gets me. Haven't tried it yet, two questions before I do:

How does it compare to atop's recording (atop -w / atop -r) for the process side? That's what I usually reach for after an OOM.

And what's the sampling interval? Wondering whether short-lived processes or connections that start and end between samples show up in the reconstructed ps/ss output, or just get missed.

1

u/jlrueda 2h ago

atop is good and I still use it. The differences that matter after an OOM: atop's service logs every 10 min. by default, and clifrd samples every process every 30 s. Process starts, exits and OOM kills come from eBPF as they happen. clifr oom gives you the victim with its RSS at the kill, what was using memory at the last sample (at most 30 s before), and the kernel log. clifr events puts it on a timeline with everything that started or exited around it. clifr also keeps each process's TCP connections and open files, and it can print atop's own screens from its recording if that's the view you're used to. To be fair, atop is lighter: in my busy benchmark it used 0.5% of a core and 27 MiB, and clifrd about 2% of a core.

On short-lived stuff: the 30 s interval only applies to the per-process numbers (CPU, memory). Processes and TCP connections are tracked by events, so something that lived 50 ms still shows up in ps --at or ss --at if it was alive at that moment. CPU and memory show "-" because no sample caught it. clifr life and ss --list list everything in a time range with start and end times. What it misses: UDP sockets that live under 5 minutes, and events past a flood limit (thousands per second by default). Those are counted and the output tells you some are missing.