-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We need a way to capture short lived connections. #356
Comments
There may be a way: |
Nope, that python project is just consulting /proc/net/tcp; their approach won't work with containers, and will only capture slight more connections that we already do. |
netstat seems to do it by walking all the entries in proc: http://sourceforge.net/p/net-tools/code/ci/master/tree/netstat.c |
I think we're going to end up using ftrace on the connect system call https://www.kernel.org/doc/Documentation/trace/ftrace.txt |
Okay some more docs about ftrace / perf_events:
Summary: I can happily use ftrace to get a realtime stream of connect and accept syscalls, including the pid & fd. They do not include the ip address, as its a pointer to a userspace struct. I think we might be able to use bpfs to do this. |
More info:
Summary: I'm quite confident ftrace + ebpf's will work well, but I think support for this was only merged into kernel 4.1. Kernel 4.1 will most likely be in ubuntu 15.10, so it seems like a dead end for the next ~6months at least 2 ideas left (1 new one):
|
Status update: got an ftrace prototype (#381), but short answer is it isn't going to work. It can't get the local addr and port number quickly enough from procfs:
|
Looks like option (2) is the |
@tomwilkie What about using some conntrack library in Go like this one? |
@tomwilkie oh, I see.. and can't we obtain the PID from somewhere in |
@inercia Thats exactly what procspy does; the problem is we can't walk too often (every few seconds) as its quite expensive, so we miss particularly short connections. This ticket is/was about finding a different way of doing it, to capture those short lived connections. |
oh, it seems I'm quite good at stating the obvious... do you need any help with anything of this? |
Conntrack will do it, but we can't map it back to a pid (at least on the client side; for servers we could look at the output of lsof)
The text was updated successfully, but these errors were encountered: