tcpconnect(8) | System Manager's Manual | tcpconnect(8) |
NAME¶
tcpconnect - Trace TCP active connections (connect()). Uses Linux eBPF/bcc.
SYNOPSIS¶
tcpconnect [-h] [-t] [-x] [-p PID] [-P PORT]
DESCRIPTION¶
This tool traces active TCP connections (eg, via a connect() syscall; accept() are passive connections). This can be useful for general troubleshooting to see what connections are initiated by the local server.
All connection attempts are traced, even if they ultimately fail.
This works by tracing the kernel tcp_v4_connect() and tcp_v6_connect() functions using dynamic tracing, and will need updating to match any changes to these functions.
Since this uses BPF, only the root user can use this tool.
REQUIREMENTS¶
CONFIG_BPF and bcc.
OPTIONS¶
EXAMPLES¶
- -U
- Include a UID column.
- -u UID
- Trace this UID only (filtered in-kernel).
- Trace all active TCP connections:
- # tcpconnect
- Trace all TCP connects, and include timestamps:
- # tcpconnect -t
- Trace PID 181 only:
- # tcpconnect -p 181
- Trace ports 80 and 81 only:
- # tcpconnect -P 80,81
FIELDS¶
- Trace all TCP connects, and include UID:
- # tcpconnect -U
FIELDS¶
- Trace UID 1000 only:
- # tcpconnect -u 1000
FIELDS¶
OVERHEAD¶
This traces the kernel tcp_v[46]_connect functions 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 that is calling a high rate of connects()s, such as a proxy server, then test and understand this overhead before use.
SOURCE¶
This is from bcc.
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.
OS¶
Linux
STABILITY¶
Unstable - in development.
AUTHOR¶
Brendan Gregg
SEE ALSO¶
tcpaccept(8), funccount(8), tcpdump(8)
2015-08-25 | USER COMMANDS |