Skip to content

Commit

Permalink
Change the conditions for determining the output accesslog
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Sep 14, 2024
1 parent f493505 commit bc49986
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions pkg/controller/telemetry/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ type logInfo struct {
}

func OutputAccesslog(data requestMetric, accesslog logInfo) {
if accesslog.destinationService != "-" || data.dstPort == uint16(15019) {
logStr := buildAccesslog(data, accesslog)
fmt.Println("accesslog:", logStr)
}
logStr := buildAccesslog(data, accesslog)
fmt.Println("accesslog:", logStr)
}

func buildAccesslog(data requestMetric, accesslog logInfo) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/telemetry/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (m *MetricController) Run(ctx context.Context, mapOfTcpInfo *ebpf.Map) {
serviceLabels.reporter = "source"
accesslog.direction = "OUTBOUND"
}
if data.state == TCP_CLOSTED {
if data.state == TCP_CLOSTED && accesslog.sourceWorkload != "-" {
OutputAccesslog(data, accesslog)
}
m.mutex.Lock()
Expand Down

0 comments on commit bc49986

Please sign in to comment.