Skip to content
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

[filebeat]: improve debug logging in udp/tcp inputs #41059

Merged
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
1 change: 1 addition & 0 deletions filebeat/input/tcp/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (s *server) Run(ctx input.Context, publisher stateless.Publisher) error {

server, err := tcp.New(&s.config.Config, streaming.SplitHandlerFactory(
inputsource.FamilyTCP, log, tcp.MetadataCallback, func(data []byte, metadata inputsource.NetworkMetadata) {
log.Debugw("Data received", "bytes", len(data), "remote_address", metadata.RemoteAddr.String(), "truncated", metadata.Truncated)
evt := beat.Event{
Timestamp: time.Now(),
Fields: mapstr.M{
Expand Down
1 change: 1 addition & 0 deletions filebeat/input/udp/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (s *server) Run(ctx input.Context, publisher stateless.Publisher) error {
defer metrics.Close()

server := udp.New(&s.config.Config, func(data []byte, metadata inputsource.NetworkMetadata) {
log.Debugw("Data received", "bytes", len(data), "remote_address", metadata.RemoteAddr.String(), "truncated", metadata.Truncated)
evt := beat.Event{
Timestamp: time.Now(),
Meta: mapstr.M{
Expand Down
1 change: 1 addition & 0 deletions filebeat/input/unix/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (s *server) Run(ctx input.Context, publisher stateless.Publisher) error {
defer metrics.close()

server, err := unix.New(log, &s.config.Config, func(data []byte, _ inputsource.NetworkMetadata) {
log.Debugw("Data received", "bytes", len(data))
evt := beat.Event{
Timestamp: time.Now(),
Fields: mapstr.M{
Expand Down
4 changes: 2 additions & 2 deletions filebeat/inputsource/common/streaming/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ func (l *Listener) handleConnection(conn net.Conn) {

// Track number of clients.
l.clientsCount.Inc()
log.Debugw("New client connection.", "active_clients", l.clientsCount.Load())
log.Debugw("New client connection", "active_clients", l.clientsCount.Load())
defer func() {
l.clientsCount.Dec()
log.Debugw("Client disconnected.", "active_clients", l.clientsCount.Load())
log.Debugw("Client disconnected", "active_clients", l.clientsCount.Load())
}()

handler := l.handlerFactory(*l.config)
Expand Down
Loading