Skip to content

Commit

Permalink
[Auditbeat] Add system module process dataset ECS categorization fiel…
Browse files Browse the repository at this point in the history
…ds (#18032)

* [Auditbeat] Add system module process dataset ECS categorization fields

* Add changelog entry

(cherry picked from commit 4bf5d62)
  • Loading branch information
Andrew Stucki committed May 4, 2020
1 parent 65e7348 commit db2c617
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Log to stderr when running using reference kubernetes manifests. {pull}17443[174443]
- 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]

*Filebeat*

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

func (action eventAction) Type() string {
switch action {
case eventActionExistingProcess:
return "info"
case eventActionProcessStarted:
return "start"
case eventActionProcessStopped:
return "end"
case eventActionProcessError:
return "info"
default:
return "info"
}
}

func init() {
mb.Registry.MustAddMetricSet(moduleName, metricsetName, New,
mb.DefaultMetricSet(),
Expand Down Expand Up @@ -319,8 +334,10 @@ func (ms *MetricSet) processEvent(process *Process, eventType string, action eve
event := mb.Event{
RootFields: common.MapStr{
"event": common.MapStr{
"kind": eventType,
"action": action.String(),
"kind": eventType,
"category": []string{"process"},
"type": []string{action.Type()},
"action": action.String(),
},
"process": process.toMapStr(),
"message": processMessage(process, action),
Expand Down
8 changes: 5 additions & 3 deletions x-pack/auditbeat/module/system/process/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ func TestProcessEvent(t *testing.T) {
}

expectedRootFields := map[string]interface{}{
"event.kind": "event",
"event.action": "process_started",
"message": "Process zsh (PID: 9086) by user elastic STARTED",
"event.kind": "event",
"event.category": []string{"process"},
"event.type": []string{"start"},
"event.action": "process_started",
"message": "Process zsh (PID: 9086) by user elastic STARTED",

"process.pid": 9086,
"process.ppid": 9085,
Expand Down

0 comments on commit db2c617

Please sign in to comment.