Skip to content

Commit

Permalink
add_host_metadata: populate host.os.type
Browse files Browse the repository at this point in the history
Adds the host.os.type field introduced by ECS 1.8.0.

Possible values for this field are:
- linux
- macos
- unix
- windows

The field will be missing for OSes not in the list.

Related #23118
  • Loading branch information
adriansr committed Feb 2, 2021
1 parent e9d66fa commit fa42ee7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 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 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

0 comments on commit fa42ee7

Please sign in to comment.