execsnoop.bt(8)

πŸ“¦
version 0.27.0 Β· 3 versions
  • 0.27.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.14.0 Β· ubuntu jammy
  • 0.20.2 Β· ubuntu noble
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ execsnoop.bt(8) β€” NAME ✨

okay so bestie, execsnoop.bt is a tool that traces new processes via exec() syscalls πŸ” and it runs on bpftrace/eBPF πŸ’–

πŸ’… SYNOPSIS πŸ’…

execsnoop.bt

🌸 DESCRIPTION 🌸

okay so this traces when processes call exec() (execve()) πŸ¦‹ it's giving detective energy for spotting new processes born from the usual fork()->exec() sequence ✨ ngl the return value is not currently traced, so the exec() may have failed πŸ’€

this tool is lowkey iconic for debugging shell scripts, including application startup πŸŽ€ it's also super useful for spotting a performance issue: a flood of short-lived processes that end quickly and aren't readily visible in top(1) πŸ™ˆ

since this uses BPF, only the root user can use this tool πŸ‘‘

🧚 REQUIREMENTS 🧚

you need CONFIG_BPF and bpftrace πŸ’œ

πŸ“ EXAMPLES πŸ“

Trace all new processes calling execve():

# execsnoop.bt

πŸ”₯ FIELDS πŸ”₯

  • TIME β€” time of the exec() call, in milliseconds since program start ⏰
  • PID β€” process ID 🫢
  • PPID β€” parent process ID πŸ‘ͺ
  • ARGS β€” process name and arguments (16 word maximum) πŸ“

🌈 OVERHEAD 🌈

this traces the execve() tracepoint and prints output for each event πŸ’… the rate is generally expected to be low (< 100/s), so the overhead is also expected to be negligible ✨ but if you have an application spawning a high rate of new processes for a reason (large build process), this could cause a small amount of overhead, so test and understand overhead before use πŸ™ˆ

πŸ¦‹ SOURCE πŸ¦‹

this is from bpftrace 🩷

https://github.com/bpftrace/bpftrace

also look in the bpftrace distribution for a companion _examples.txt file with example usage, output, and commentary for this tool πŸ“š

this is a bpftrace version of the bcc tool of the same name πŸ’– the bcc tool provides more fields and options to customize the output πŸŽ€

https://github.com/iovisor/bcc

πŸ’» OS πŸ’»

Linux 🐧

πŸ₯Ί STABILITY πŸ₯Ί

Unstable - in development. 🚧

πŸ‘‘ AUTHOR πŸ‘‘

Brendan Gregg 🫢

πŸ”— SEE ALSO πŸ”—


USER COMMANDS Β· 2018-09-11 Β· execsnoop.bt(8) πŸ’œ bestie, that's the whole tea, now go trace those processes, periodt! πŸ’…πŸŒΈ