Skip to content

Commit

Permalink
Adding exportable channel into Config struct. In this way a third party
Browse files Browse the repository at this point in the history
entity can read from the channel without any dependencies with the
tracee printers.
  • Loading branch information
mtcherni95 authored and itaysk committed Jun 30, 2021
1 parent ef8d4ee commit ae07c82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tracee-ebpf/tracee/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,12 @@ func (t *Tracee) printEvent(done <-chan struct{}, in <-chan external.Event) (<-c
go func() {
defer close(errc)
for printEvent := range in {
t.stats.eventCounter.Increment()
t.printer.Print(printEvent)
if t.config.ChanEvents != nil {
t.config.ChanEvents <- printEvent
} else {
t.stats.eventCounter.Increment()
t.printer.Print(printEvent)
}
}
}()
return errc, nil
Expand Down
1 change: 1 addition & 0 deletions tracee-ebpf/tracee/tracee.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Config struct {
SecurityAlerts bool
maxPidsCache int // maximum number of pids to cache per mnt ns (in Tracee.pidsInMntns)
BPFObjPath string
ChanEvents chan external.Event
}

type Filter struct {
Expand Down

0 comments on commit ae07c82

Please sign in to comment.