Skip to content

Commit

Permalink
comply with ECS for host.name
Browse files Browse the repository at this point in the history
Upgrades go-sysinfo to v1.14.1, which does not lower-case the FQDN. Therefore, `host.name` returned by  `host.MapHostInfo` is lower-cased to comply with ECS.
  • Loading branch information
AndersonQ committed Jul 25, 2024
1 parent 0f81a1e commit 75d8f73
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 12 deletions.
42 changes: 36 additions & 6 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-structform@v


--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-sysinfo
Version: v1.14.0
Dependency : github.com/AndersonQ/go-sysinfo
Version: v0.0.0-20240723133639-576a5a94e18c
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.14.0/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/!anderson!q/go-sysinfo@v0.0.0-20240723133639-576a5a94e18c/LICENSE.txt:


Apache License
Expand Down Expand Up @@ -1480,12 +1480,12 @@ limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/gofrs/uuid
Version: v4.4.0+incompatible
Dependency : github.com/gofrs/uuid/v5
Version: v5.2.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gofrs/uuid@v4.4.0+incompatible/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/gofrs/uuid/[email protected]/LICENSE:

Copyright (C) 2013-2018 by Maxim Bublis <[email protected]>

Expand Down Expand Up @@ -3243,6 +3243,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/gofrs/uuid
Version: v4.4.0+incompatible
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gofrs/[email protected]+incompatible/LICENSE:

Copyright (C) 2013-2018 by Maxim Bublis <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/gogo/protobuf
Version: v1.3.2
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ require (
gotest.tools/v3 v3.5.1 // indirect
howett.net/plist v1.0.1 // indirect
)

replace github.com/elastic/go-sysinfo => github.com/AndersonQ/go-sysinfo v0.0.0-20240723133639-576a5a94e18c
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/AndersonQ/go-sysinfo v0.0.0-20240723133639-576a5a94e18c h1:JmYm9QiTPvea7Ya4NSVG0vUwZ9Q+qbfAW3mpkMgHB0E=
github.com/AndersonQ/go-sysinfo v0.0.0-20240723133639-576a5a94e18c/go.mod h1:FKUXnZWhnYI0ueO7jhsGV3uQJ5hiz8OqM5b3oGyaRr8=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
Expand All @@ -23,8 +25,6 @@ github.com/elastic/go-licenser v0.4.2 h1:bPbGm8bUd8rxzSswFOqvQh1dAkKGkgAmrPxbUi+
github.com/elastic/go-licenser v0.4.2/go.mod h1:W8eH6FaZDR8fQGm+7FnVa7MxI1b/6dAqxz+zPB8nm5c=
github.com/elastic/go-structform v0.0.9 h1:HpcS7xljL4kSyUfDJ8cXTJC6rU5ChL1wYb6cx3HLD+o=
github.com/elastic/go-structform v0.0.9/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
github.com/elastic/go-sysinfo v1.14.0 h1:dQRtiqLycoOOla7IflZg3aN213vqJmP0lpVpKQ9lUEY=
github.com/elastic/go-sysinfo v1.14.0/go.mod h1:FKUXnZWhnYI0ueO7jhsGV3uQJ5hiz8OqM5b3oGyaRr8=
github.com/elastic/go-ucfg v0.8.8 h1:54KIF/2zFKfl0MzsSOCGOsZ3O2bnjFQJ0nDJcLhviyk=
github.com/elastic/go-ucfg v0.8.8/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA=
github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0=
Expand Down
4 changes: 3 additions & 1 deletion metric/system/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package host

import (
"strings"

"github.com/elastic/elastic-agent-libs/mapstr"
"github.com/elastic/elastic-agent-libs/monitoring"
"github.com/elastic/go-sysinfo"
Expand All @@ -33,7 +35,7 @@ func MapHostInfo(info types.HostInfo, fqdn string) mapstr.M {

data := mapstr.M{
"host": mapstr.M{
"name": name,
"name": strings.ToLower(name),
"hostname": info.Hostname,
"architecture": info.Architecture,
"os": mapstr.M{
Expand Down
6 changes: 3 additions & 3 deletions metric/system/host/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestMapHostInfo(t *testing.T) {
Architecture: "x86_64",
BootTime: bootTime,
Containerized: &containerized,
Hostname: "foo",
Hostname: "fOo",
IPs: []string{"1.2.3.4", "192.168.1.1"},
KernelVersion: "22.3.0",
MACs: []string{"56:9c:17:54:19:15", "5c:e9:1e:c4:37:66"},
Expand All @@ -66,7 +66,7 @@ func TestMapHostInfo(t *testing.T) {
"host": mapstr.M{
"architecture": "x86_64",
"containerized": true,
"hostname": "foo",
"hostname": "fOo",
"id": "a39b4c1ee4",
"name": "foo.bar.local",
"os": mapstr.M{
Expand All @@ -87,7 +87,7 @@ func TestMapHostInfo(t *testing.T) {
"host": mapstr.M{
"architecture": "x86_64",
"containerized": true,
"hostname": "foo",
"hostname": "fOo",
"id": "a39b4c1ee4",
"name": "foo",
"os": mapstr.M{
Expand Down

0 comments on commit 75d8f73

Please sign in to comment.