This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch reduce-handle-connect-time
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/reduce-handle-connect-time by 
this push:
     new 5ad68ed  add filter
5ad68ed is described below

commit 5ad68ed7ad3019473cac6176c0640977667c7fa4
Author: mrproliu <[email protected]>
AuthorDate: Sat Dec 28 11:34:02 2024 +0800

    add filter
---
 pkg/tools/ip/conntrack.go | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
index da3852e..d1e9774 100644
--- a/pkg/tools/ip/conntrack.go
+++ b/pkg/tools/ip/conntrack.go
@@ -19,6 +19,7 @@ package ip
 
 import (
        "context"
+       "fmt"
        nativeLog "log"
        "net"
        "syscall"
@@ -64,14 +65,19 @@ func NewConnTrack() (*ConnTrack, error) {
                                        event.Origin.Proto.SrcPort == nil || 
event.Origin.Proto.DstPort == nil ||
                                        event.Reply == nil || event.Reply.Src 
== nil || event.Reply.Dst == nil || event.Reply.Proto == nil ||
                                        event.Reply.Proto.SrcPort == nil || 
event.Reply.Proto.DstPort == nil {
-                                       if event.Info != nil {
-                                               log.Errorf("conntrack event: 
proto info: %+v", event.Info)
-                                       }
                                        return 0
                                }
-                               log.Infof("conntrack event: origin: 
%s:%d->%s:%d, reply: %s:%d->%s:%d",
+                               if *event.Origin.Proto.DstPort == 53 {
+                                       return 0
+                               }
+                               info := ""
+                               if event.Info != nil {
+                                       info = fmt.Sprintf("%+v", event.Info)
+                               }
+                               log.Infof("conntrack event: origin: 
%s:%d->%s:%d, reply: %s:%d->%s:%d, info: %s",
                                        event.Origin.Src.String(), 
*event.Origin.Proto.SrcPort, event.Origin.Dst.String(), 
*event.Origin.Proto.DstPort,
-                                       event.Reply.Src.String(), 
*event.Reply.Proto.SrcPort, event.Reply.Dst.String(), 
*event.Reply.Proto.DstPort)
+                                       event.Reply.Src.String(), 
*event.Reply.Proto.SrcPort, event.Reply.Dst.String(), 
*event.Reply.Proto.DstPort,
+                                       info)
                                return 0
                        })
        }()

Reply via email to