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 Name into add-host-metadata #9405

Merged
merged 4 commits into from
Dec 7, 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 @@ -95,6 +95,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d
- The `elasticsearch/node` metricset now reports the Elasticsearch cluster UUID. {pull}8771[8771]
- Add service.type field to Metricbeat. {pull}8965[8965]
- Support GET requests in Jolokia module. {issue}8566[8566] {pull}9226[9226]
- 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 @@ -918,7 +918,8 @@ The fields added to the event are looking as following:
"build":"16G1212",
"platform":"darwin",
"version":"10.12.6",
"kernel":"16.7.0"
"kernel":"16.7.0",
"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,
"kernel": info.KernelVersion,
},
},
Expand Down Expand Up @@ -73,6 +74,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)
monitoring.ReportString(V, "kernel", info.KernelVersion)

if info.OS.Codename != "" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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 @@ -96,6 +100,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