Skip to content

Add filebeat_input to beat receiver agent monitoring integration test #8338

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

Merged
merged 3 commits into from
Jun 12, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -653,6 +653,63 @@ inputs:
binary: filebeat
id: filestream-monitoring
target: component
- data_stream:
dataset: elastic_agent.filebeat_input
namespace: default
type: metrics
failure_threshold: 5
hosts:
- placeholder
id: metrics-monitoring-filebeat-1
index: metrics-elastic_agent.filebeat_input-default
json.is_array: true
metricsets:
- json
namespace: filebeat_input
path: /inputs/
period: 1m0s
processors:
- add_fields:
fields:
dataset: elastic_agent.filebeat_input
target: event
- add_fields:
fields:
id: ""
process: filebeat
snapshot: false
version: placeholder
target: elastic_agent
- add_fields:
fields:
id: ""
target: agent
- copy_fields:
fail_on_error: false
fields:
- from: http.agent.beat.cpu
to: system.process.cpu
- from: http.agent.beat.memstats.memory_sys
to: system.process.memory.size
- from: http.agent.beat.handles
to: system.process.fd
- from: http.agent.beat.cgroup
to: system.process.cgroup
- from: http.agent.apm-server
to: apm-server
- from: http.filebeat_input
to: filebeat_input
ignore_missing: true
- drop_fields:
fields:
- http
- system
ignore_missing: true
- add_fields:
fields:
binary: filebeat
id: filestream-otel
target: component
- data_stream:
dataset: elastic_agent.elastic_agent
namespace: default
4 changes: 1 addition & 3 deletions internal/pkg/agent/application/monitoring/v1_monitor.go
Original file line number Diff line number Diff line change
@@ -700,8 +700,7 @@ func (b *BeatsMonitor) getHttpStreams(
httpStreams = append(httpStreams, httpStream)
}
// specifically for filebeat, we include input metrics
// disabled for filebeat receiver until https://github.com/elastic/beats/issues/43418 is resolved
if strings.EqualFold(name, "filebeat") && compInfo.RuntimeManager != component.OtelRuntimeManager {
if strings.EqualFold(name, "filebeat") {
fbDataStreamName := "filebeat_input"
fbDataset := fmt.Sprintf("elastic_agent.%s", fbDataStreamName)
fbIndexName := fmt.Sprintf("metrics-elastic_agent.%s-%s", fbDataStreamName, monitoringNamespace)
@@ -842,7 +841,6 @@ func processorsForAgentFilestream() []any {
addFormattedIndexProcessor(),
)
return processors

}

// processorsForServiceComponentFilestream returns processors used for filestream streams for components running as
10 changes: 1 addition & 9 deletions internal/pkg/agent/application/monitoring/v1_monitor_test.go
Original file line number Diff line number Diff line change
@@ -141,7 +141,6 @@ func TestMonitoringWithEndpoint(t *testing.T) {
Enabled: true,
MonitorMetrics: true,
HTTP: &monitoringcfg.MonitoringHTTPConfig{

Enabled: true,
},
},
@@ -213,7 +212,6 @@ func TestMonitoringWithEndpoint(t *testing.T) {
require.Equal(t, uint64(1234), streamValues["process.pid"])
}
}

}
}
}
@@ -222,7 +220,6 @@ func TestMonitoringWithEndpoint(t *testing.T) {
}

func TestMonitoringConfigMetricsInterval(t *testing.T) {

agentInfo, err := info.NewAgentInfo(context.Background(), false)
require.NoError(t, err, "Error creating agent info")
components := []component.Component{{ID: "foobeat", InputSpec: &component.InputRuntimeSpec{BinaryName: "filebeat"}}}
@@ -317,7 +314,6 @@ func TestMonitoringConfigMetricsInterval(t *testing.T) {
}

for _, tc := range tcs {

t.Run(tc.name, func(t *testing.T) {
b := &BeatsMonitor{
enabled: true,
@@ -370,7 +366,6 @@ func TestMonitoringConfigMetricsInterval(t *testing.T) {
}

func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) {

agentInfo, err := info.NewAgentInfo(context.Background(), false)
require.NoError(t, err, "Error creating agent info")
components := []component.Component{{ID: "foobeat", InputSpec: &component.InputRuntimeSpec{BinaryName: "filebeat"}}}
@@ -552,7 +547,6 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) {
}

for _, tc := range tcs {

t.Run(tc.name, func(t *testing.T) {
b := &BeatsMonitor{
enabled: true,
@@ -603,7 +597,6 @@ func TestMonitoringConfigMetricsFailureThreshold(t *testing.T) {
}

func TestErrorMonitoringConfigMetricsFailureThreshold(t *testing.T) {

agentInfo, err := info.NewAgentInfo(context.Background(), false)
components := []component.Component{{ID: "foobeat", InputSpec: &component.InputRuntimeSpec{BinaryName: "filebeat"}}}
require.NoError(t, err, "Error creating agent info")
@@ -729,7 +722,6 @@ func TestErrorMonitoringConfigMetricsFailureThreshold(t *testing.T) {
}

for _, tc := range tcs {

t.Run(tc.name, func(t *testing.T) {
b := &BeatsMonitor{
enabled: true,
@@ -936,7 +928,7 @@ func TestMonitoringConfigForBeatsReceivers(t *testing.T) {
}
}
}
assert.Len(t, streamsForInputMetrics, 2)
assert.Len(t, streamsForInputMetrics, 3)
}

func TestMonitoringWithOtelRuntime(t *testing.T) {
Loading
Oops, something went wrong.