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

[pkg/stanza] Windows input operator should resubscribe when remote host restarts #35175

Merged
Merged
Prev Previous commit
Next Next commit
Recreate subscription if failing to read events
  • Loading branch information
kuiperda committed Sep 23, 2024
commit a3bc0e102a7e3502c036cb96268e8cb09bab96d1
8 changes: 6 additions & 2 deletions pkg/stanza/operator/input/windows/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ func (i *Input) read(ctx context.Context) int {
events, err := i.subscription.Read(i.maxReads)
if err != nil {
i.Logger().Error("Failed to read events from subscription", zap.Error(err))
i.subscription.Close()
closeErr := i.subscription.Close()
if closeErr != nil {
i.Logger().Error("Failed to close subscription", zap.Error(closeErr))
return 0
}
i.Logger().Info("Recreating subscription")
i.subscription = NewRemoteSubscription(i.remote.Server)
kuiperda marked this conversation as resolved.
Show resolved Hide resolved
i.Logger().Info("Reopening subscription")
return 0
}

Expand Down