Improve logging

This commit is contained in:
Daniel 2021-08-18 09:34:00 +02:00
parent f2bc518e2f
commit b314b46fb8
2 changed files with 5 additions and 4 deletions

View file

@ -173,12 +173,12 @@ func checkSelfCommunication(ctx context.Context, conn *network.Connection, _ *pr
DstPort: pktInfo.DstPort, DstPort: pktInfo.DstPort,
}, true) }, true)
if err != nil { if err != nil {
log.Tracer(ctx).Warningf("filter: failed to find local peer process PID: %s", err) log.Tracer(ctx).Debugf("filter: failed to find local peer process PID: %s", err)
} else { } else {
// get primary process // get primary process
otherProcess, err := process.GetOrFindProcess(ctx, otherPid) otherProcess, err := process.GetOrFindProcess(ctx, otherPid)
if err != nil { if err != nil {
log.Tracer(ctx).Warningf("filter: failed to find load local peer process with PID %d: %s", otherPid, err) log.Tracer(ctx).Debugf("filter: failed to find load local peer process with PID %d: %s", otherPid, err)
} else if otherProcess.Path == conn.Process().Path { } else if otherProcess.Path == conn.Process().Path {
conn.Accept("process internal connection", noReasonOptionKey) conn.Accept("process internal connection", noReasonOptionKey)
conn.Internal = true conn.Internal = true
@ -346,7 +346,6 @@ func checkBypassPrevention(ctx context.Context, conn *network.Connection, p *pro
case endpoints.Permitted: case endpoints.Permitted:
conn.AcceptWithContext("bypass prevention: "+reason, profile.CfgOptionPreventBypassingKey, reasonCtx) conn.AcceptWithContext("bypass prevention: "+reason, profile.CfgOptionPreventBypassingKey, reasonCtx)
return true return true
case endpoints.NoMatch:
} }
} }
return false return false

View file

@ -50,7 +50,9 @@ func updatePids() {
statData, err := os.Stat(fmt.Sprintf("/proc/%d", pid)) statData, err := os.Stat(fmt.Sprintf("/proc/%d", pid))
if err != nil { if err != nil {
log.Warningf("proc: could not stat /proc/%d: %s", pid, err) if !os.IsNotExist(err) {
log.Warningf("proc: could not stat /proc/%d: %s", pid, err)
}
continue entryLoop continue entryLoop
} }
sys, ok := statData.Sys().(*syscall.Stat_t) sys, ok := statData.Sys().(*syscall.Stat_t)