Skip to content

Commit

Permalink
[Auditbeat] Add ECS categories for system-host module (#18031)
Browse files Browse the repository at this point in the history
* [Auditbeat] Add ECS categories for system-host module

* Add changelog entry

* Add host.name

* Add host.name to ECS-only fields

* Remove added 'name' field
  • Loading branch information
Andrew Stucki authored May 5, 2020
1 parent ed3a0e9 commit dece318
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- 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 system module socket dataset ECS categorization fields. {pull}18036[18036]
- 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

0 comments on commit dece318

Please sign in to comment.