exitsnoop(8)
π exitsnoop(8) β¨ System Manager's Manual β¨
NAME π
exitsnoop - Trace all process termination (exit, fatal signal). Uses Linux eBPF/bcc. okay so this is the tool that tells you every time a process dies, bestie πβ¨
β¨ SYNOPSIS β¨
exitsnoop [-h] [-t] [--utc] [-x] [-p PID] [--label LABEL] [--per-thread]
πΈ DESCRIPTION πΈ
okay so exitsnoop traces process termination, showing the command name and the reason it ended, either a normal exit or a fatal signal π
It catches processes of all users π, processes running in containers π¦, and processes that become zombie π§ (iconic, honestly).
This works by tracing the kernel sched_process_exit() function using dynamic tracing, and it will need updating to match any changes to this function π§ so keep an eye on that one, bestie.
β οΈ Since this uses BPF, only the root user can use this tool. no cap, not for you, not for me π
π§ REQUIREMENTS π§
You need CONFIG_BPF and bcc. that's the whole vibe π«Ά
π OPTIONS π
-hβ the lowkey usage message, printed for you π-tβ adds a timestamp column β°--utcβ adds a timestamp column too, but it uses the UTC timezone π-xβ excludes successful exits, soexit( 0 )gets filtered out π«-p PIDβ traces this process ID only (filtered in-kernel) π―--label LABELβ labels each line with LABEL in the first column (second if timestamp is there). the default is'exit'π·οΈ--per-threadβ traces per thread termination π§΅
π EXAMPLES π
Trace all process termination:
# exitsnoop
Trace all process termination, and include timestamps:
# exitsnoop -t
Exclude successful exits, only include non-zero exit codes and fatal signals:
# exitsnoop -x
Trace PID 181 only:
# exitsnoop -p 181
Label each output line with 'EXIT':
# exitsnoop --label EXIT
Trace per thread termination:
# exitsnoop --per-thread
π¦ FIELDS π¦
- TIME-TZ β time of process termination as
HH:MM:SS.ssswith milliseconds, where TZ is the local time zone (orUTCwith the--utcoption) β±οΈ - LABEL β the optional label if the
--labeloption is used. this is super useful with-ttimestamps when the output of several tracing tools gets sorted into one combined output π«§ - PCOMM β process/command name π£
- PID β process ID π’
- PPID β the process ID of the process that will be notified of the PID termination π
- TID β thread ID π§΅
- EXIT_CODE β the exit code for
exit(), or the signal number for a fatal signal π¦
π OVERHEAD π
This traces the kernel sched_process_exit() function and prints output for each event. As the rate of this is generally expected to be low (< 1000/s), the overhead is also expected to be negligible. If you have an application with a high rate of process termination, then test and understand the overhead before using it π§ be careful, bestie.
π SOURCE π
This is from bcc. π
https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool π very helpful, highkey.
π OS π
Linux π§
π§ͺ STABILITY π§ͺ
Unstable - in development. it's still cooking π³
π AUTHOR π
Arturo Martin-de-Nicolas π«Ά
π SEE ALSO π
execsnoop(8) π
ok bestie, that's the whole tea βπ this page came from bcc, check the _examples.txt for more, and it's a USER COMMANDS page dated 2019-05-28, the manual page for exitsnoop(8) πβ¨ periodt π
π¦
π¦ where this page comes from
- centos-stream 10: bcc-tools 0.36.1-1.el10 Β· Apache-2.0
- centos-stream 9: bcc-tools 0.36.1-1.el9 Β· ASL 2.0
- fedora 43: bcc-tools 0.35.0-2.fc43 Β· Apache-2.0
- fedora 44: bcc-tools 0.35.0-5.fc44 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms