Skip to content

Commit a5428e9

Browse files
committed
Separate flag for reading trace pipe to logging
Conflating verbose BPF logging with reading the trace pipe resulted in some operatational functionality loss, seperate the two. Sometimes its nice to use bpftool to read the bpf logs separately.
1 parent afb96f1 commit a5428e9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

flags/flags.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ type FlagsHidden struct {
391391
}
392392

393393
type FlagsBPF struct {
394-
VerboseLogging bool `help:"Enable verbose BPF logging."`
394+
VerboseLogging bool `help:"Enable verbose BPF logging from eBPF code to ebpf trace_pipe."`
395+
LogTracePipe bool `help:"Copy bpf trace_pipe to info logging."`
395396
EventsBufferSize uint32 `default:"8192" help:"Size in pages of the events buffer."`
396397
MapScaleFactor int `default:"${default_map_scale_factor}" help:"Scaling factor for eBPF map sizes. Every increase by 1 doubles the map size. Increase if you see eBPF map size errors. Default is ${default_map_scale_factor} corresponding to 4GB of executable address space, max is ${max_map_scale_factor}."`
397398
VerifierLogLevel uint32 `default:"0" help:"Log level of the eBPF verifier output (0,1,2). Default is 0."`

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ func mainWithExitCode() flags.ExitCode {
536536
return flags.Failure("Failed to start trace handler: %v", err)
537537
}
538538

539-
if f.BPF.VerboseLogging {
539+
if f.BPF.LogTracePipe {
540540
go readTracePipe(mainCtx)
541541
}
542542

@@ -656,7 +656,7 @@ func readTracePipe(ctx context.Context) {
656656
}
657657
line = strings.TrimSpace(line)
658658
if len(line) > 0 {
659-
log.Debugf("%s", line)
659+
log.Infof("bpf: %s", line)
660660
}
661661
}
662662
}

0 commit comments

Comments
 (0)