diff --git a/NOTICE.txt b/NOTICE.txt index 2dfd636a46d..aac0fc8f1a1 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1348,11 +1348,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-system-metrics -Version: v0.10.4 +Version: v0.10.6 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.10.4/LICENSE.txt: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.10.6/LICENSE.txt: Apache License Version 2.0, January 2004 @@ -2193,11 +2193,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-licenser@v0. -------------------------------------------------------------------------------- Dependency : github.com/elastic/go-sysinfo -Version: v1.14.0 +Version: v1.14.1 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/elastic/go-sysinfo@v1.14.1/LICENSE.txt: Apache License diff --git a/changelog/fragments/1721910073-Fix-FQDN-being-lower-cased-for-.yaml b/changelog/fragments/1721910073-Fix-FQDN-being-lower-cased-for-.yaml new file mode 100644 index 00000000000..c625d23c9e2 --- /dev/null +++ b/changelog/fragments/1721910073-Fix-FQDN-being-lower-cased-for-.yaml @@ -0,0 +1,32 @@ +# Kind can be one of: +# - breaking-change: a change to previously-documented behavior +# - deprecation: functionality that is being removed in a later release +# - bug-fix: fixes a problem in a previous version +# - enhancement: extends functionality but does not break or fix existing behavior +# - feature: new functionality +# - known-issue: problems that we are aware of in a given version +# - security: impacts on the security of a product or a user’s deployment. +# - upgrade: important information for someone upgrading from a prior version +# - other: does not fit into any of the other categories +kind: bug + +# Change summary; a 80ish characters long description of the change. +summary: Fix FQDN being lower-cased for `host.hostname` + +# Long description; in case the summary is not enough to describe the change +# this field accommodate a description without length limits. +# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. +#description: + +# Affected component; a word indicating the component this changeset affects. +component: host metadata + +# PR URL; optional; the PR number that added the changeset. +# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. +# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. +# Please provide it if you are adding a fragment for a different PR. +pr: https://github.com/elastic/elastic-agent/pull/5191 + +# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). +# If not present is automatically filled by the tooling with the issue linked to the PR number. +issue: https://github.com/elastic/beats/issues/39993 diff --git a/go.mod b/go.mod index 0bbac67f9b3..f5da6e13e29 100644 --- a/go.mod +++ b/go.mod @@ -14,11 +14,11 @@ require ( github.com/elastic/elastic-agent-autodiscover v0.8.0 github.com/elastic/elastic-agent-client/v7 v7.15.0 github.com/elastic/elastic-agent-libs v0.9.15 - github.com/elastic/elastic-agent-system-metrics v0.10.4 + github.com/elastic/elastic-agent-system-metrics v0.10.6 github.com/elastic/elastic-transport-go/v8 v8.6.0 github.com/elastic/go-elasticsearch/v8 v8.14.0 github.com/elastic/go-licenser v0.4.2 - github.com/elastic/go-sysinfo v1.14.0 + github.com/elastic/go-sysinfo v1.14.1 github.com/elastic/go-ucfg v0.8.8 github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015 github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor v0.7.1 diff --git a/go.sum b/go.sum index c1c04668a33..113882134d9 100644 --- a/go.sum +++ b/go.sum @@ -748,8 +748,8 @@ github.com/elastic/elastic-agent-client/v7 v7.15.0 h1:nDB7v8TBoNuD6IIzC3z7Q0y+7b github.com/elastic/elastic-agent-client/v7 v7.15.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI= github.com/elastic/elastic-agent-libs v0.9.15 h1:WCLtuErafUxczT/rXJa4Vr6mxwC8dgtqMbEq+qWGD4M= github.com/elastic/elastic-agent-libs v0.9.15/go.mod h1:2VgYxHaeM+cCDBjiS2wbmTvzPGbnlXAtYrlcLefheS8= -github.com/elastic/elastic-agent-system-metrics v0.10.4 h1:Tmb1rPRDyVv9M453YlPyl/gwUm9s4nSiI2xH76GGEz4= -github.com/elastic/elastic-agent-system-metrics v0.10.4/go.mod h1:cd7YgcTEjBNeLGnH/C9cEvP/YexohwS6CpmN9Ju58Mw= +github.com/elastic/elastic-agent-system-metrics v0.10.6 h1:tY2LlqvZqguN4QcIOKtx57w/o9ZqmaeoJequwYC34mE= +github.com/elastic/elastic-agent-system-metrics v0.10.6/go.mod h1:tGOvE8Eunm0vZQ5Rh9T9GHYITLsZdywBr3CuvsPlycs= github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA= github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/elastic/go-docappender/v2 v2.2.0 h1:Pq6w+R0ZbWlqZHoqzoujR2ElKBfaPUf3M/cJvPVSrfA= @@ -762,8 +762,8 @@ 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.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gnCJPDo1w= github.com/elastic/go-structform v0.0.10/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-sysinfo v1.14.1 h1:BpY/Utfz75oKSpsQnbAJmmlnT3gBV9WFsopBEYgjhZY= +github.com/elastic/go-sysinfo v1.14.1/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.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI= diff --git a/internal/pkg/agent/application/info/agent_metadata.go b/internal/pkg/agent/application/info/agent_metadata.go index 3a26944c446..d5223e75242 100644 --- a/internal/pkg/agent/application/info/agent_metadata.go +++ b/internal/pkg/agent/application/info/agent_metadata.go @@ -7,12 +7,11 @@ package info import ( "context" "fmt" - - "github.com/elastic/elastic-agent/pkg/features" - "runtime" "strings" + "github.com/elastic/elastic-agent/pkg/features" + "github.com/elastic/elastic-agent/internal/pkg/agent/application/paths" "github.com/elastic/elastic-agent/internal/pkg/agent/errors" "github.com/elastic/elastic-agent/internal/pkg/release" @@ -173,7 +172,7 @@ func (i *AgentInfo) ECSMetadata(l *logger.Logger) (*ECSMeta, error) { Host: &HostECSMeta{ Arch: info.Architecture, Hostname: hostname, - Name: hostname, + Name: strings.ToLower(hostname), ID: info.UniqueID, IP: info.IPs, MAC: info.MACs, @@ -211,7 +210,7 @@ func (i *AgentInfo) ECSMetadataFlatMap(l *logger.Logger) (map[string]interface{} // Host meta[hostArchKey] = info.Architecture meta[hostHostnameKey] = hostname - meta[hostNameKey] = hostname + meta[hostNameKey] = strings.ToLower(hostname) meta[hostIDKey] = info.UniqueID meta[hostIPKey] = fmt.Sprintf("[%s]", strings.Join(info.IPs, ",")) meta[hostMACKey] = fmt.Sprintf("[%s]", strings.Join(info.MACs, ",")) diff --git a/internal/pkg/composable/providers/host/host.go b/internal/pkg/composable/providers/host/host.go index afb48b32c05..eb344bc89cc 100644 --- a/internal/pkg/composable/providers/host/host.go +++ b/internal/pkg/composable/providers/host/host.go @@ -9,6 +9,7 @@ import ( "fmt" "reflect" "runtime" + "strings" "time" "github.com/elastic/elastic-agent/internal/pkg/agent/errors" @@ -141,7 +142,7 @@ func getHostInfo(log *logger.Logger) func() (map[string]interface{}, error) { return map[string]interface{}{ "id": info.UniqueID, - "name": name, + "name": strings.ToLower(name), "platform": runtime.GOOS, "architecture": info.Architecture, "ip": info.IPs,