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 -U Include a UID column.
41
42 -u UID Trace this UID only (filtered in-kernel).
43
44 Trace all active TCP connections:
45 # tcpconnect
46
47 Trace all TCP connects, and include timestamps:
48 # tcpconnect -t
49
50 Trace PID 181 only:
51 # tcpconnect -p 181
52
53 Trace ports 80 and 81 only:
54 # tcpconnect -P 80,81
55
57 Trace all TCP connects, and include UID:
58 # tcpconnect -U
59
61 Trace UID 1000 only:
62 # tcpconnect -u 1000
63
65 TIME(s)
66 Time of the call, in seconds.
67
68 UID User ID
69
70 PID Process ID
71
72 COMM Process name
73
74 IP IP address family (4 or 6)
75
76 SADDR Source IP address.
77
78 DADDR Destination IP address.
79
80 DPORT Destination port
81
83 This traces the kernel tcp_v[46]_connect functions and prints output
84 for each event. As the rate of this is generally expected to be low (<
85 1000/s), the overhead is also expected to be negligible. If you have an
86 application that is calling a high rate of connects()s, such as a proxy
87 server, then test and understand this overhead before use.
88
90 This is from bcc.
91
92 https://github.com/iovisor/bcc
93
94 Also look in the bcc distribution for a companion _examples.txt file
95 containing example usage, output, and commentary for this tool.
96
98 Linux
99
101 Unstable - in development.
102
104 Brendan Gregg
105
107 tcpaccept(8), funccount(8), tcpdump(8)
108
109
110
111USER COMMANDS 2015-08-25 tcpconnect(8)