Exectrace is a project mainly written in C and PYTHON, it's free.
A kernel module for FreeBSD to generate log messages when something is exeve'd
This is a kernel module for FreeBSD that will generate messages whenever any process forks, execves or exits. I originally wrote it to figure out how to speed up booting.
The format of the log messages is:
exectrace
Where [args] is only printed for execve calls and
exectrace fork 4.814815017 27-25 exectrace execve 4.814974395 27-25 /sbin/sysctl -n vfs.nfs.diskless_valid exectrace exit 4.816830217 27-25
'make install' the module and to /boot/loader.conf add:
exectrace_load="YES" kern.msgbufsize=4194304
With the etparse.py script you can generate nicely formated output from exectrace logs. It will print a tree of processes. By default, it will read from stdin, so:
dmesg | ./etparse.py
may already do what you want. Alternatively, specify the file to read with -f, and you can force truncation of long lines with -t:
./etparse.py -f mylog -t 80
The output format is: