forked from genuinetools/bpfd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stdout.go
54 lines (44 loc) · 1.12 KB
/
stdout.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package stdout
import (
"fmt"
"github.com/genuinetools/bpfd/action"
"github.com/genuinetools/bpfd/api/grpc"
)
const (
name = "stdout"
)
type stdoutAction struct{}
func init() {
action.Register(name, Init)
}
// Init returns a new stdout action.
func Init() (action.Action, error) {
return &stdoutAction{}, nil
}
func (s *stdoutAction) String() string {
return name
}
func (s *stdoutAction) Do(event *grpc.Event) error {
/* logrus.WithFields(logrus.Fields{
"tracer": event.Tracer,
"pid": fmt.Sprintf("%d", event.PID),
"tgid": fmt.Sprintf("%d", event.TGID),
"uid": fmt.Sprintf("%d", event.UID),
"gid": fmt.Sprintf("%d", event.GID),
"command": event.Command,
"return_value": fmt.Sprintf("%d", event.ReturnValue),
"container_runtime": string(event.ContainerRuntime),
"container_id": event.ContainerID,
}).Infof("%#v", event.Data)*/
fmt.Printf("%s\t%d\t%d\t%d\t%d\t%s\t%s\t%s\n",
event.Tracer,
event.PID,
event.TGID,
event.UID,
event.GID,
event.Command,
event.ContainerRuntime,
event.ContainerID,
)
return nil
}