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

Cherry-pick to 6.x: Add OS Name into add-host-metadata (#9405) #9471

Merged
merged 1 commit into from
Dec 11, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ https://github.com/elastic/beats/compare/v6.5.0...6.x[Check the HEAD diff]
- Test etcd module with etcd 3.3. {pull}9068[9068]
- Add setting to disable docker cpu metrics per core. {pull}9194[9194]
- The `elasticsearch/node` metricset now reports the Elasticsearch cluster UUID. {pull}8771[8771]
- Add `host.os.name` field to add_host_metadata processor. {issue}8948[8948] {pull}9405[9405]

*Packetbeat*

Expand Down
3 changes: 2 additions & 1 deletion libbeat/docs/processors-using.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ The fields added to the event are looking as following:
"family":"darwin",
"build":"16G1212",
"platform":"darwin",
"version":"10.12.6"
"version":"10.12.6",
"name":"Mac OS X"
},
"ip": ["192.168.0.1", "10.0.0.1"],
"mac": ["00:25:96:12:34:56", "72:00:06:ff:79:f1"]
Expand Down
2 changes: 2 additions & 0 deletions libbeat/metric/system/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func MapHostInfo(info types.HostInfo) common.MapStr {
"platform": info.OS.Platform,
"version": info.OS.Version,
"family": info.OS.Family,
"name": info.OS.Name,
},
},
}
Expand Down Expand Up @@ -72,6 +73,7 @@ func ReportInfo(_ monitoring.Mode, V monitoring.Visitor) {
monitoring.ReportString(V, "platform", info.OS.Platform)
monitoring.ReportString(V, "version", info.OS.Version)
monitoring.ReportString(V, "family", info.OS.Family)
monitoring.ReportString(V, "name", info.OS.Name)

if info.OS.Codename != "" {
monitoring.ReportString(V, "codename", info.OS.Codename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func TestConfigDefault(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, v)

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

v, err = newEvent.GetValue("host.ip")
assert.Error(t, err)
assert.Nil(t, v)
Expand Down Expand Up @@ -84,6 +88,10 @@ func TestConfigNetInfoEnabled(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, v)

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

v, err = newEvent.GetValue("host.ip")
assert.NoError(t, err)
assert.NotNil(t, v)
Expand Down