Skip to content
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ elastic-agent.yml.*
fleet.yml
fleet.yml.lock
fleet.yml.old
pkg/component/fake/component/component
internal/pkg/agent/application/filelock/testlocker/testlocker
internal/pkg/agent/install/testblocking/testblocking
internal/pkg/otel/manager/testing/testing
pkg/component/fake/component/component
pkg/core/process/testsignal/testsignal
4 changes: 2 additions & 2 deletions NOTICE-fips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,11 +1254,11 @@ SOFTWARE

--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-libs
Version: v0.26.1
Version: v0.28.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.26.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.28.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
34 changes: 2 additions & 32 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,11 +1254,11 @@ SOFTWARE

--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-libs
Version: v0.26.1
Version: v0.28.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.26.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.28.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -46050,36 +46050,6 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/opentelemetry-l
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/elastic/pkcs8
Version: v1.0.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

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

The MIT License (MIT)

Copyright (c) 2014 youmark

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/elastic/sarama
Version: v1.19.1-0.20250603175145-7672917f26b6
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/elastic/cloud-on-k8s/v2 v2.0.0-20250327073047-b624240832ae
github.com/elastic/elastic-agent-autodiscover v0.10.0
github.com/elastic/elastic-agent-client/v7 v7.17.2
github.com/elastic/elastic-agent-libs v0.26.1
github.com/elastic/elastic-agent-libs v0.28.0
github.com/elastic/elastic-agent-system-metrics v0.13.4
github.com/elastic/elastic-transport-go/v8 v8.8.0
github.com/elastic/go-elasticsearch/v8 v8.19.0
Expand Down Expand Up @@ -352,7 +352,6 @@ require (
github.com/elastic/opentelemetry-collector-components/internal/sharedcomponent v0.0.0-20250220025958-386ba0c4bced // indirect
github.com/elastic/opentelemetry-collector-components/processor/lsmintervalprocessor v0.8.0 // indirect
github.com/elastic/opentelemetry-lib v0.21.0 // indirect
github.com/elastic/pkcs8 v1.0.0 // indirect
github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
Expand Down
9 changes: 2 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ github.com/elastic/elastic-agent-autodiscover v0.10.0 h1:WJ4zl9uSfk1kHmn2B/0byQB
github.com/elastic/elastic-agent-autodiscover v0.10.0/go.mod h1:Nf3zh9FcJ9nTTswTwDTUAqXmvQllOrNliM6xmORSxwE=
github.com/elastic/elastic-agent-client/v7 v7.17.2 h1:Cl2TeABqWZgW40t5fchGWT/sRk4MDDLWA0d8iHHOxLA=
github.com/elastic/elastic-agent-client/v7 v7.17.2/go.mod h1:5irRFqp6HLqtu1S+OeY0jg8x7K6PLL+DW+PwVk1vJnk=
github.com/elastic/elastic-agent-libs v0.26.1 h1:ywjSQajyjiv7zQTsyZjghIVb7PpPCrXZRUOhbV3KdFM=
github.com/elastic/elastic-agent-libs v0.26.1/go.mod h1:o/iXtbHYaojpG4BOY7Z3hFMQAgEoqq2owO17JPGpf3A=
github.com/elastic/elastic-agent-libs v0.28.0 h1:UDL9aSxgjqC9TrHAEHgI8gtuhRYPM/1gSfh7ztHWWLw=
github.com/elastic/elastic-agent-libs v0.28.0/go.mod h1:0xUg7alsNE/WhY9DZRIdTYW75nqSHC1octIAg//j/PQ=
github.com/elastic/elastic-agent-system-metrics v0.13.4 h1:gX8VdlQyakPcPKFpD7uHv2QLRDyguuKfZgu0LE27V7c=
github.com/elastic/elastic-agent-system-metrics v0.13.4/go.mod h1:lB8veYWYBlA9eF6TahmPN87G1IEgWlbep7QSqLSW90U=
github.com/elastic/elastic-transport-go/v8 v8.8.0 h1:7k1Ua+qluFr6p1jfJjGDl97ssJS/P7cHNInzfxgBQAo=
Expand Down Expand Up @@ -561,8 +561,6 @@ github.com/elastic/opentelemetry-collector-components/processor/lsmintervalproce
github.com/elastic/opentelemetry-collector-components/processor/lsmintervalprocessor v0.8.0/go.mod h1:uQHpGpKwGHhdO5fm2hx1mthiPMiScmFOp5XNwD0EqVw=
github.com/elastic/opentelemetry-lib v0.21.0 h1:aktZQ6hocz/yVMOikDrdcjWtl/qcK/AfMBundZJTCcQ=
github.com/elastic/opentelemetry-lib v0.21.0/go.mod h1:mNcdHi6ivTn5w4bE18as43gzKt2rVmK4HCeJZ9JmFXk=
github.com/elastic/pkcs8 v1.0.0 h1:HhitlUKxhN288kcNcYkjW6/ouvuwJWd9ioxpjnD9jVA=
github.com/elastic/pkcs8 v1.0.0/go.mod h1:ipsZToJfq1MxclVTwpG7U/bgeDtf+0HkUiOxebk95+0=
github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6 h1:2COw7kzXkIyS4hKNUl5qw0KolrwncrY4VVNpngVNo8I=
github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6/go.mod h1:Ua/oXS4NS+U/pp/urxgzEGWd1MvocHA+yd4Bu4+Eb80=
github.com/elazarl/goproxy v0.0.0-20240909085733-6741dbfc16a1 h1:g7YUigN4dW2+zpdusdTTghZ+5Py3BaUMAStvL8Nk+FY=
Expand Down Expand Up @@ -1903,7 +1901,6 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
Expand Down Expand Up @@ -2027,7 +2024,6 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
Expand All @@ -2043,7 +2039,6 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
Expand Down
4 changes: 3 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,9 @@ func (Integration) Local(ctx context.Context, testName string) error {
// run the integration tests but only run test that can run locally
params := devtools.DefaultGoTestIntegrationArgs()
params.Tags = append(params.Tags, "local")
params.Packages = []string{"github.com/elastic/elastic-agent/testing/integration"}
params.Packages = []string{
"github.com/elastic/elastic-agent/testing/integration/...",
}

var goTestFlags []string
rawTestFlags := os.Getenv("GOTEST_FLAGS")
Expand Down
55 changes: 38 additions & 17 deletions testing/integration/ess/otel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/elastic/elastic-agent-libs/testing/fs"

"github.com/elastic/elastic-agent-libs/mapstr"
"github.com/elastic/elastic-agent-libs/testing/estools"
"github.com/elastic/elastic-agent-libs/transport/tlscommontest"
Expand Down Expand Up @@ -463,6 +465,12 @@ exporters:
elasticsearch:
api_key: {{.ESApiKey}}
endpoint: {{.ESEndpoint}}
logs_index: {{.TestId}}
sending_queue:
wait_for_result: true
block_on_overflow: true
enabled: true
queue_size: 10000
mapping:
mode: none

Expand All @@ -489,6 +497,13 @@ service:
- resource/add-test-id
receivers:
- filelog
telemetry:
logs:
level: DEBUG
encoding: json
disable_stacktrace: true
output_paths:
- {{.OTelLogFile}}
`

func TestOtelLogsIngestion(t *testing.T) {
Expand All @@ -506,8 +521,9 @@ func TestOtelLogsIngestion(t *testing.T) {
// Prepare the OTel config.
testId := info.Namespace

tempDir := t.TempDir()
tempDir := fs.TempDir(t, "..", "..", "..", "build")
inputFilePath := filepath.Join(tempDir, "input.log")
otelLogFilePath := filepath.Join(tempDir, "elastic-agent.ndjson")

esHost, err := integration.GetESHost()
require.NoError(t, err, "failed to get ES host")
Expand All @@ -524,6 +540,7 @@ func TestOtelLogsIngestion(t *testing.T) {
logsIngestionConfig = strings.ReplaceAll(logsIngestionConfig, "{{.ESEndpoint}}", esHost)
logsIngestionConfig = strings.ReplaceAll(logsIngestionConfig, "{{.InputFilePath}}", inputFilePath)
logsIngestionConfig = strings.ReplaceAll(logsIngestionConfig, "{{.TestId}}", testId)
logsIngestionConfig = strings.ReplaceAll(logsIngestionConfig, "{{.OTelLogFile}}", otelLogFilePath)

cfgFilePath := filepath.Join(tempDir, "otel.yml")
require.NoError(t, os.WriteFile(cfgFilePath, []byte(logsIngestionConfig), 0o600))
Expand Down Expand Up @@ -557,26 +574,30 @@ func TestOtelLogsIngestion(t *testing.T) {
require.NoError(t, err)
}
inputFile.Close()
t.Cleanup(func() {
_ = os.Remove(inputFilePath)
})

actualHits := &struct{ Hits int }{}
require.Eventually(t,
func() bool {
findCtx, findCancel := context.WithTimeout(context.Background(), 10*time.Second)
// It takes about 45s to ingest all files on local tests,
// so set the timeout to 5min to be on the safe side.
require.EventuallyWithT(
t,
func(c *assert.CollectT) {
findCtx, findCancel := context.WithTimeout(t.Context(), 10*time.Second)
defer findCancel()

docs, err := estools.GetLogsForIndexWithContext(findCtx, esClient, ".ds-logs-generic-default*", map[string]interface{}{
"Resource.test.id": testId,
})
require.NoError(t, err)

actualHits.Hits = docs.Hits.Total.Value
return actualHits.Hits == logsCount
docs, err := estools.GetAllLogsForIndexWithContext(
findCtx,
esClient,
testId)
require.NoError(c, err)
require.Equalf(
c,
logsCount,
docs.Hits.Total.Value,
"expecting %d events",
logsCount)
},
2*time.Minute, 1*time.Second,
"Expected %v logs, got %v", logsCount, actualHits)
5*time.Minute,
time.Second,
"did not find the expected number of events")

cancel()
fixtureWg.Wait()
Expand Down