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

Add os.type field from ECS 1.8 #23513

Merged
merged 4 commits into from
Feb 2, 2021
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: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add kubernetes.volume.fs.used.pct field. {pull}23564[23564]
- Add the `enable_krb5_fast` flag to the Kafka output to explicitly opt-in to FAST authentication. {pull}23629[23629]
- Add deployment name in pod's meta. {pull}23610[23610]
- Added ECS 1.8 `host.os.type` field to `add_host_metadata` processor. {pull}23513[23513]

*Auditbeat*

Expand All @@ -618,6 +619,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add ECS categorization info for auditd module {pull}18596[18596]
- Add several improvements for auditd module for improved ECS field mapping {pull}22647[22647]
- Add ECS 1.7 `configuration` categorization in certain events in auditd module. {pull}23000[23000]
- system/host: Add new ECS 1.8 field `os.type` in `host.os.type`. {pull}23513[23513]

*Filebeat*

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7665,11 +7665,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-structform@v

--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-sysinfo
Version: v1.3.0
Version: v1.5.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.3.0/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.5.0/LICENSE.txt:


Apache License
Expand Down
10 changes: 10 additions & 0 deletions auditbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12336,6 +12336,16 @@ type: keyword
The operating system's kernel version.


type: keyword

--

*`system.audit.host.os.type`*::
+
--
OS type (see ECS os.type).


type: keyword

--
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ require (
github.com/elastic/go-perf v0.0.0-20191212140718-9c656876f595
github.com/elastic/go-seccomp-bpf v1.1.0
github.com/elastic/go-structform v0.0.7
github.com/elastic/go-sysinfo v1.3.0
github.com/elastic/go-sysinfo v1.5.0
github.com/elastic/go-txfile v0.0.7
github.com/elastic/go-ucfg v0.8.3
github.com/elastic/go-windows v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ github.com/elastic/go-seccomp-bpf v1.1.0/go.mod h1:l+89Vy5BzjVcaX8USZRMOwmwwDScE
github.com/elastic/go-structform v0.0.7 h1:ihszOJQryNuIIHE2ZgsbiDq+agKO6V4yK0JYAI3tjzc=
github.com/elastic/go-structform v0.0.7/go.mod h1:QrMyP3oM9Sjk92EVGLgRaL2lKt0Qx7ZNDRWDxB6khVs=
github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
github.com/elastic/go-sysinfo v1.3.0 h1:eb2XFGTMlSwG/yyU9Y8jVAYLIzU2sFzWXwo2gmetyrE=
github.com/elastic/go-sysinfo v1.3.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
github.com/elastic/go-sysinfo v1.5.0 h1:6DBn+WmxLz+IJ9MY+MzX2rWQNd04vSRB3TSuXu/2JjU=
github.com/elastic/go-sysinfo v1.5.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
github.com/elastic/go-txfile v0.0.7 h1:Yn28gclW7X0Qy09nSMSsx0uOAvAGMsp6XHydbiLVe2s=
github.com/elastic/go-txfile v0.0.7/go.mod h1:H0nCoFae0a4ga57apgxFsgmRjevNCsEaT6g56JoeKAE=
github.com/elastic/go-ucfg v0.7.0/go.mod h1:iaiY0NBIYeasNgycLyTvhJftQlQEUO2hpF+FX0JKxzo=
Expand Down
4 changes: 3 additions & 1 deletion libbeat/metric/system/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ func MapHostInfo(info types.HostInfo) common.MapStr {
if info.OS.Build != "" {
data.Put("host.os.build", info.OS.Build)
}

if info.OS.Type != "" {
data.Put("host.os.type", info.OS.Type)
}
return data
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func TestConfigDefault(t *testing.T) {
v, err = newEvent.GetValue("host.mac")
assert.NoError(t, err)
assert.NotNil(t, v)

v, err = newEvent.GetValue("host.os.type")
assert.NoError(t, err)
assert.NotNil(t, v)
}

func TestConfigNetInfoDisabled(t *testing.T) {
Expand Down Expand Up @@ -118,6 +122,10 @@ func TestConfigNetInfoDisabled(t *testing.T) {
v, err = newEvent.GetValue("host.mac")
assert.Error(t, err)
assert.Nil(t, v)

v, err = newEvent.GetValue("host.os.type")
assert.NoError(t, err)
assert.NotNil(t, v)
}

func TestConfigName(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The fields added to the event look like the following:
"id":"",
"os":{
"family":"darwin",
"type":"macos",
"build":"16G1212",
"platform":"darwin",
"version":"10.12.6",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/auditbeat/module/system/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x-pack/auditbeat/module/system/host/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
},
"timezone.name": "UTC",
"timezone.offset.sec": 0,
"type": "linux",
"uptime": 18661357350265
}
}
Expand Down
4 changes: 4 additions & 0 deletions x-pack/auditbeat/module/system/host/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@
type: keyword
description: >
The operating system's kernel version.
- name: type
type: keyword
description: >
OS type (see ECS os.type).
5 changes: 5 additions & 0 deletions x-pack/auditbeat/module/system/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ func (host *Host) toMapStr() common.MapStr {
mapstr.Put("os.codename", host.Info.OS.Codename)
}

if host.Info.OS.Type != "" {
mapstr.Put("os.type", host.Info.OS.Type)
}

var ipStrings []string
for _, ip := range host.Ips {
ipStrings = append(ipStrings, ip.String())
Expand Down Expand Up @@ -362,6 +366,7 @@ func hostEvent(host *Host, eventType string, action eventAction) mb.Event {
hostFields.CopyFieldsTo(hostTopLevel, "os.kernel")
hostFields.CopyFieldsTo(hostTopLevel, "os.name")
hostFields.CopyFieldsTo(hostTopLevel, "os.platform")
hostFields.CopyFieldsTo(hostTopLevel, "os.type")
hostFields.CopyFieldsTo(hostTopLevel, "os.version")

event.RootFields.Put("host", hostTopLevel)
Expand Down