Skip to content

Commit

Permalink
adding chan out
Browse files Browse the repository at this point in the history
  • Loading branch information
mtcherni95 committed Jun 28, 2021
1 parent 741e7bb commit c777e2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tracee-ebpf/tracee/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,22 @@ func (t *Tracee) prepareEventForPrint(done <-chan struct{}, in <-chan RawEvent)

func (t *Tracee) printEvent(done <-chan struct{}, in <-chan external.Event) (<-chan error, error) {
errc := make(chan error, 1)
go func() {
defer close(errc)
for printEvent := range in {
t.stats.eventCounter.Increment()
t.printer.Print(printEvent)
}
}()
if t.config.ChanEvents == nil {
go func() {
defer close(errc)
for printEvent := range in {
t.stats.eventCounter.Increment()
t.printer.Print(printEvent)
}
}()
} else {
go func() {
defer close(errc)
for event := range in {
t.config.ChanEvents <- event
}
}()
}
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 c777e2a

Please sign in to comment.