Skip to content

Commit cd29567

Browse files
authored
Merge pull request #93 from coroot/log_listen_events
container: log TCP listen open/close events
2 parents 990c7e9 + 0f7052a commit cd29567

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

containers/container.go

+3
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ func (c *Container) onFileOpen(pid uint32, fd uint64) {
435435
}
436436

437437
func (c *Container) onListenOpen(pid uint32, addr netaddr.IPPort, safe bool) {
438+
klog.Infof("TCP listen open pid=%d id=%s addr=%s", pid, c.id, addr)
438439
if common.PortFilter.ShouldBeSkipped(addr.Port()) {
439440
return
440441
}
@@ -463,6 +464,7 @@ func (c *Container) onListenOpen(pid uint32, addr netaddr.IPPort, safe bool) {
463464
if ips, err = proc.GetNsIps(ns); err != nil {
464465
klog.Warningln(err)
465466
} else {
467+
klog.Infof("got IPs %s for %s", ips, nsId)
466468
c.ipsByNs[nsId] = ips
467469
}
468470
}
@@ -471,6 +473,7 @@ func (c *Container) onListenOpen(pid uint32, addr netaddr.IPPort, safe bool) {
471473
}
472474

473475
func (c *Container) onListenClose(pid uint32, addr netaddr.IPPort) {
476+
klog.Infof("TCP listen close pid=%d id=%s addr=%s", pid, c.id, addr)
474477
c.lock.Lock()
475478
defer c.lock.Unlock()
476479
if _, byAddr := c.listens[addr]; byAddr {

0 commit comments

Comments
 (0)