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

[Auditbeat] Add ECS categories for system-host module #18031

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix syscall kprobe arguments for 32-bit systems in socket module. {pull}17500[17500]
- Fix memory leak on when we miss socket close kprobe events. {pull}17500[17500]
- Add system module process dataset ECS categorization fields. {pull}18032[18032]
- Add ECS categories for system module host dataset. {pull}18031[18031]

*Filebeat*

Expand Down
23 changes: 21 additions & 2 deletions x-pack/auditbeat/module/system/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ func (action eventAction) String() string {
}
}

func (action eventAction) Type() string {
switch action {
case eventActionHost:
return "info"
case eventActionIDChanged:
return "change"
case eventActionReboot:
return "start"
case eventActionHostnameChanged:
return "change"
case eventActionHostChanged:
return "change"
default:
return "info"
}
}

// Host represents information about a host.
type Host struct {
Info types.HostInfo
Expand Down Expand Up @@ -322,8 +339,10 @@ func hostEvent(host *Host, eventType string, action eventAction) mb.Event {
event := mb.Event{
RootFields: common.MapStr{
"event": common.MapStr{
"kind": eventType,
"action": action.String(),
"kind": eventType,
"category": []string{"host"},
"type": []string{action.Type()},
"action": action.String(),
},
"message": hostMessage(host, action),
},
Expand Down