Skip to content

Commit

Permalink
Minor fixes for ETW input
Browse files Browse the repository at this point in the history
  • Loading branch information
chemamartinez committed Oct 27, 2023
1 parent 2a35f77 commit e854e35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions x-pack/filebeat/input/etw/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

//go:build windows

package etw_input

import (
Expand Down
10 changes: 6 additions & 4 deletions x-pack/filebeat/input/etw/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

//go:build windows

package etw_input

import (
Expand Down Expand Up @@ -92,10 +94,10 @@ func (e *etw_input) Run(ctx input.Context, publisher stateless.Publisher) error

// Define callback that will process ETW events
// Callback which receives every ETW event from the reading source
eventReceivedCallback := func(er *etw.EventRecord) {
eventReceivedCallback := func(er *etw.EventRecord) uintptr {
if er == nil {
e.log.Error("received null event record")
return
return 1
}

e.log.Debugf("received event %d with length %d", er.EventHeader.EventDescriptor.Id, er.UserDataLength)
Expand All @@ -107,7 +109,7 @@ func (e *etw_input) Run(ctx input.Context, publisher stateless.Publisher) error
event["EventProperties"] = data
} else {
e.log.Errorf("failed to read event properties: %s", err)
return
return 1
}

evt := beat.Event{
Expand All @@ -119,7 +121,7 @@ func (e *etw_input) Run(ctx input.Context, publisher stateless.Publisher) error
}
publisher.Publish(evt)

return
return 0
}

e.etwSession.Callback = syscall.NewCallback(eventReceivedCallback)
Expand Down

0 comments on commit e854e35

Please sign in to comment.