PHP 8.5.2
Preview: tcpaccept_example.txt Size: 1.32 KB
/usr/share/doc/bpftrace/examples/tcpaccept_example.txt

Demonstrations of tcpaccept, the Linux bpftrace/eBPF version.


This tool traces the kernel function accepting TCP socket connections (eg, a
passive connection via accept(); not connect()). Some example output (IP
addresses changed to protect the innocent):

# ./tcpaccept.bt
Tracing tcp accepts. Hit Ctrl-C to end.
TIME     PID     COMM           RADDR          RPORT LADDR          LPORT BL
00:34:19 3949061 nginx          10.228.22.228  44226 10.229.20.169  8088  0/128
00:34:19 3951399 ruby           127.0.0.1      52422 127.0.0.1      8000  0/128
00:34:19 3949062 nginx          10.228.23.128  35408 10.229.20.169  8080  0/128


This output shows three connections, an IPv4 connections to PID 3951399, a "ruby"
process listening on port 8000, and one connection to a "nginx" process
listening on port 8080. The remote address and port are also printed, and the accept queue
current size as well as maximum size are shown.

The overhead of this tool should be negligible, since it is only tracing the
kernel function performing accept. It is not tracing every packet and then
filtering.

This tool only traces successful TCP accept()s. Connection attempts to closed
ports will not be shown (those can be traced via other functions).

There is another version of this tool in bcc: https://github.com/iovisor/bcc

USAGE message:

# ./tcpaccept.bt

Directory Contents

Dirs: 0 × Files: 38

Name Size Perms Modified Actions
722 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.75 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.01 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.87 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.93 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.60 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
4.80 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
4.50 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.50 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
923 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
846 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
864 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.82 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
844 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.63 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.47 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.47 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
8.43 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
980 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.38 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
4.40 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.87 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
2.67 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
549 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
541 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.12 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.32 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.06 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.23 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.56 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.13 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
940 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.15 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
680 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.17 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
929 B lrw-r--r-- 2024-03-07 22:14:52
Edit Download
1.92 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download
3.34 KB lrw-r--r-- 2024-03-07 22:14:52
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).