Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user: support event processor #462

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion user/event/event_openssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (se *SSLDataEvent) String() string {

func (se *SSLDataEvent) Clone() IEventStruct {
event := new(SSLDataEvent)
event.eventType = EventTypeModuleData //EventTypeEventProcessor
event.eventType = EventTypeEventProcessor
return event
}

Expand Down
19 changes: 13 additions & 6 deletions user/module/imodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,22 @@ func (m *Module) Decode(em *ebpf.Map, b []byte) (event event.IEventStruct, err e
return te, nil
}

// 写入数据,或者上传到远程数据库,写入到其他chan 等。
// Dispatcher 写入数据,或者上传到远程数据库,写入到其他chan 等。
func (m *Module) Dispatcher(e event.IEventStruct) {
switch e.EventType() {
case event.EventTypeOutput:
if m.conf.GetHex() {

// If Hex mode is enabled, data in hex format is directly printed for event processor and output events
if m.conf.GetHex() {
if e.EventType() == event.EventTypeEventProcessor || e.EventType() == event.EventTypeOutput {
m.logger.Println(e.StringHex())
} else {
m.logger.Println(e.String())
return
}
}

// If Hex mode is not enabled, or if the event_processor and output events are not enabled,
// they will be handled according to multiple branches of the switch
switch e.EventType() {
case event.EventTypeOutput:
m.logger.Println(e.String())
case event.EventTypeEventProcessor:
m.processor.Write(e)
case event.EventTypeModuleData:
Expand Down
Loading