1tcpconnect(8) System Manager's Manual tcpconnect(8)
2
3
4
6 tcpconnect - Trace TCP active connections (connect()). Uses Linux
7 eBPF/bcc.
8
10 tcpconnect [-h] [-t] [-x] [-p PID] [-P PORT]
11
13 This tool traces active TCP connections (eg, via a connect() syscall;
14 accept() are passive connections). This can be useful for general trou‐
15 bleshooting to see what connections are initiated by the local server.
16
17 All connection attempts are traced, even if they ultimately fail.
18
19 This works by tracing the kernel tcp_v4_connect() and tcp_v6_connect()
20 functions using dynamic tracing, and will need updating to match any
21 changes to these functions.
22
23 Since this uses BPF, only the root user can use this tool.
24
26 CONFIG_BPF and bcc.
27
29 -h Print usage message.
30
31 -t Include a timestamp column.
32
33 -p PID Trace this process ID only (filtered in-kernel).
34
35 -P PORT
36 Comma-separated list of destination ports to trace (filtered in-
37 kernel).
38
40 Trace all active TCP connections:
41 # tcpconnect
42
43 Trace all TCP connects, and include timestamps:
44 # tcpconnect -t
45
46 Trace PID 181 only:
47 # tcpconnect -p 181
48
49 Trace ports 80 and 81 only:
50 # tcpconnect -P 80,81
51
53 TIME(s)
54 Time of the call, in seconds.
55
56 PID Process ID
57
58 COMM Process name
59
60 IP IP address family (4 or 6)
61
62 SADDR Source IP address.
63
64 DADDR Destination IP address.
65
66 DPORT Destination port
67
69 This traces the kernel tcp_v[46]_connect functions and prints output
70 for each event. As the rate of this is generally expected to be low (<
71 1000/s), the overhead is also expected to be negligible. If you have an
72 application that is calling a high rate of connects()s, such as a proxy
73 server, then test and understand this overhead before use.
74
76 This is from bcc.
77
78 https://github.com/iovisor/bcc
79
80 Also look in the bcc distribution for a companion _examples.txt file
81 containing example usage, output, and commentary for this tool.
82
84 Linux
85
87 Unstable - in development.
88
90 Brendan Gregg
91
93 tcpaccept(8), funccount(8), tcpdump(8)
94
95
96
97USER COMMANDS 2015-08-25 tcpconnect(8)