From cad94450c5be7eeba965492c3590c0cfa5ecebed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Mar 2026 15:24:34 +0000 Subject: [PATCH 1/3] Initial plan From 61c2e9e99a1e880c05563795670799b122cbf490 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Mar 2026 15:25:41 +0000 Subject: [PATCH 2/3] Guard TCP input debug logging with IsDebug() check Agent-Logs-Url: https://github.com/elastic/beats/sessions/a6f371a4-cf63-4b2e-8596-5b63bc4f773b Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com> --- filebeat/input/net/tcp/input.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/filebeat/input/net/tcp/input.go b/filebeat/input/net/tcp/input.go index d56a862b0ffa..19b043f4fe97 100644 --- a/filebeat/input/net/tcp/input.go +++ b/filebeat/input/net/tcp/input.go @@ -120,11 +120,13 @@ func (s *server) Run(ctx input.Context, evtChan chan<- netinput.DataMetadata, m func(data []byte, metadata inputsource.NetworkMetadata) { now := time.Now() m.EventReceived(len(data), now) - ctx.Logger.Debugw( - "Data received", - "bytes", len(data), - "remote_address", metadata.RemoteAddr.String(), - "truncated", metadata.Truncated) + if ctx.Logger.IsDebug() { + ctx.Logger.Debugw( + "Data received", + "bytes", len(data), + "remote_address", metadata.RemoteAddr.String(), + "truncated", metadata.Truncated) + } evtChan <- netinput.DataMetadata{ Data: data, From f677eb00b378635779d8f7a66798138c17c347e7 Mon Sep 17 00:00:00 2001 From: William Easton Date: Mon, 30 Mar 2026 08:42:01 -0500 Subject: [PATCH 3/3] fix: resolve lint issues in tcp input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use (*net.ListenConfig).Listen instead of net.Listen (noctx) - Fix typo: initalises → initialises - Lowercase error string (ST1005) Co-Authored-By: Claude Opus 4.6 (1M context) --- filebeat/input/net/tcp/input.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/filebeat/input/net/tcp/input.go b/filebeat/input/net/tcp/input.go index 19b043f4fe97..50c5a7183971 100644 --- a/filebeat/input/net/tcp/input.go +++ b/filebeat/input/net/tcp/input.go @@ -18,6 +18,7 @@ package tcp import ( + "context" "fmt" "net" "time" @@ -88,14 +89,14 @@ func newServer(config config) (*server, error) { func (s *server) Name() string { return "tcp" } func (s *server) Test(_ input.TestContext) error { - l, err := net.Listen("tcp", s.Host) + l, err := (&net.ListenConfig{}).Listen(context.Background(), "tcp", s.Host) if err != nil { return err } return l.Close() } -// InitMetrics initalises and returns an netmetrics.TCP +// InitMetrics initialises and returns a netmetrics.TCP func (s *server) InitMetrics(id string, reg *monitoring.Registry, logger *logp.Logger) netinput.Metrics { s.metrics = netmetrics.NewTCP(reg, s.Host, time.Minute, logger) return s.metrics @@ -139,7 +140,7 @@ func (s *server) Run(ctx input.Context, evtChan chan<- netinput.DataMetadata, m ctx.Logger, ) if err != nil { - return fmt.Errorf("Failed to start TCP server: %w", err) + return fmt.Errorf("failed to start TCP server: %w", err) } ctx.Logger.Debug("tcp input initialized")