killsnoop.bt(8)

πŸ“¦
version 0.27.0 Β· 5 versions
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

✨ killsnoop.bt β€” the manual page, but make it cute ✨

okay bestie, pull up a chair, we're reading the killsnoop.bt page from the System Manager's Manual together and it's gonna be a whole vibe πŸ’–


🌸 NAME 🌸

killsnoop.bt β€” this lil icon traces signals issued by the kill(), tkill(), tgkill() syscall. and yes, it uses bpftrace/eBPF, no cap πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

killsnoop.bt

that's it. that's the whole thing. she's low maintenance πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so killsnoop traces the kill(), tkill(), tgkill() syscall, so you can actually see the signals getting sent this way. ngl this is lowkey perfect for troubleshooting failing applications when some unknown mechanism is out there sending signals and you're like "who?? who did this??" 😭

the way it works: it traces the kill(), tkill(), tgkill() syscall tracepoints. tracing, but make it ✨telepathic✨

since this uses BPF, only the root user can use this tool. root only, bestie. no sneaking in πŸ™ˆ

🌈 REQUIREMENTS 🌈

  • CONFIG_BPF
  • bpftrace

both. you need both. that's the vibe check πŸ’œ


⭐ EXAMPLES ⭐

trace all the kill(), tkill(), tgkill() syscalls, every single one, main character energy:

# killsnoop.bt

πŸ‘‘ FIELDS πŸ‘‘

here's what each column is giving, one by one, no skipping 🫢

  • TIME β€” time of the kill call. when it happened ⏰
  • PID β€” source process ID
  • COMM β€” source process name
  • SIG β€” signal number or name. see signal(7)
  • TPID β€” target process ID
  • RESULT β€” the result. 0 == success, and a negative value (of the error code) for failure. so if it's negative, something said no πŸ’€

πŸ’€ OVERHEAD πŸ’€

this traces the kernel kill function and prints output for every single event. and because the rate of this is generally expected to be low (< 100/s), the overhead is also expected to be negligible. obsessed with a low-overhead tool honestly πŸ“

but listen β€” if you have an application that is calling a very high rate of kill()|tkill()|tgkill()s for some reason, then test and understand overhead before use. fr fr. test first, then send it. not the other way around πŸ™ˆ

🧚 SOURCE 🧚

this is from bpftrace.

https://github.com/bpftrace/bpftrace

also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's giving bonus content, we love her πŸ’–

this is a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations, iykyk πŸ‘‘

https://github.com/iovisor/bcc

🌸 OS 🌸

Linux. (obviously, she's a kernel tool πŸ’…)


⚠️ STABILITY ⚠️

Unstable β€” in development. she's still growing, be gentle πŸŽ€


πŸ’œ AUTHOR πŸ’œ

Brendan Gregg, Rong Tao. absolute legends, we thank them for their service 🫢


🌟 SEE ALSO 🌟


okay that's the whole page, you ate that 🍽️✨

this beauty lives under USER COMMANDS, and she was dated 2018-09-07. go forth and trace some signals, bestie πŸ’–πŸ¦‹πŸŽ€