killsnoop.bt(8)

πŸ“¦ version 0.17.0, in debian bookworm

πŸ’… killsnoop.bt β€” the tea β˜•

okay bestie, listen. killsnoop.bt lives in section 8 of the system manager's manual, and it's about to become your new fave. it traces the signals that get sent through the kill() syscall, using bpftrace/eBPF. no cap. ✨


🌸 NAME 🌸

killsnoop.bt β€” trace signals issued by the kill() syscall. uses bpftrace/eBPF. periodt. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

killsnoop.bt

that's it. that's the whole vibe. she takes no arguments, she just goes. πŸ‘‘


✨ DESCRIPTION ✨

so killsnoop traces the kill() syscall, and it shows you the signals that get sent this way. why do you care? because sometimes an app is just out here failing for no apparent reason, and some unknown mechanism is out there sending signals like it's a secret admirer. this tool exposes them. πŸ•΅οΈβ™€οΈπŸ’…

the way it works: it traces the kill() syscall tracepoints. that's the whole trick.

🚨 real talk: since this uses BPF, only the root user can use this tool. not a suggestion, that's just the rules. πŸ”’

πŸ¦‹ REQUIREMENTS πŸ¦‹

  • CONFIG_BPF
  • bpftrace

that's the list. go get 'em. 🫢


🌈 EXAMPLES 🌈

trace all kill() syscalls:

# killsnoop.bt

iconic. one line. she ate. πŸ”₯


πŸ“ FIELDS πŸ“

here's what every column means, bestie, so you're not out here squinting:

  • TIME β€” time of the kill call. ⏰
  • PID β€” source process ID (who's doing the killing πŸ‘€)
  • COMM β€” source process name
  • SIG β€” signal number. see signal(7) for the lore.
  • TPID β€” target process ID (who's getting got)
  • RES β€” the result. 0 == success πŸŽ‰, a negative value (of the error code) for failure 😭

πŸ’œ OVERHEAD πŸ’œ

so this traces the kernel kill function and prints output for each and every event. normally the rate of this is expected to be low (< 100/s), so the overhead is also expected to be negligible. she's lightweight, she's chill. 🧚

BUT. if you've got an application that's calling a very high rate of kill()s for some reason (ma'am, why), then test and understand overhead before use. do not just rawdog it into production. πŸ™ˆ

⭐ SOURCE ⭐

this is from bpftrace.

https://github.com/iovisor/bpftrace

also, go look in the bpftrace distribution for a companion _examples.txt file β€” it's got example usage, output, and commentary for this tool. basically the director's cut. 🎬

this is a bpftrace version of the bcc tool of the same name. heads up: the bcc tool may provide more options and customizations, so if you want extra toppings, check that one out too.

https://github.com/iovisor/bcc

πŸ‘‘ OS πŸ‘‘

Linux β€” that's the one. 🐧


πŸ’€ STABILITY πŸ’€

Unstable β€” in development. she's a work in progress and we love her for it. 🚧


🌸 AUTHOR 🌸

Brendan Gregg β€” the blueprint, the moment, the legend. 🫢


πŸ”₯ SEE ALSO πŸ”₯


okay that's the whole page!! πŸ’– this one was brought to you by the USER COMMANDS section, dated 2018-09-07, filed under killsnoop.bt(8) β€” go forth and trace those signals, bestie. slay. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from