Now moved into `github.com/inspektor-gadget/inspektor-gadget/pkg/gadget-collection/gadgets/traceloop`. Tracing system calls in cgroups using BPF and overwritab
Now moved into `github.com/inspektor-gadget/inspektor-gadget/pkg/gadget-collection/gadgets/traceloop`. Tracing system calls in cgroups using BPF and overwritab
traceloop is a command line tool to trace system calls in a similar way to strace but with some differences:
traceloop can be used directly on the command line or via an HTTP interface.
traceloop has been written to trace Kubernetes Pods with Inspektor
Gadget, but it can as easily be
used with systemd services that are in their own control groups (look for
.service and .scope directories inside /sys/fs/cgroup/unified/).
Example with an existing systemd service:
sudo -E ./traceloop cgroups /sys/fs/cgroup/unified/system.slice/sshd.serviceExample with a custom command:
…docker run --rm -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/fs/bpf:/sys/fs/bpf -v /run:/run --privileged kinvolk/traceloopsudo -E ./traceloop serve
...
$ sudo curl --unix-socket /run/traceloop.socket 'http://localhost/add?name=sshd&cgrouppath=/sys/fs/cgroup/unified/system.slice/sshd.service'
added as id 0
$ sudo curl --unix-socket /run/traceloop.socket 'http://localhost/list'
0: [sshd] /sys/fs/cgroup/unified/system.slice/sshd.service
$ sudo curl --unix-socket /run/traceloop.socket 'http://localhost/dump-by-cgroup?cgroup=/sys/fs/cgroup/unified/system.slice/sshd.service'
...
A comprehensive presentation was held at LPC 2020 in the Networking and BPF Summit. See the slides here.
After feedback to include a comparison to perf trace we reran the benchmark but omitted the synchronous write syscall case that logs the buffer contents because dumping the buffers is not implemented in perf trace. Here the results:
No open issues yet, or sync has not completed.