diff --git a/pkg/stanza/operator/input/windows/input.go b/pkg/stanza/operator/input/windows/input.go index 9994386a649a..dc0061885ae4 100644 --- a/pkg/stanza/operator/input/windows/input.go +++ b/pkg/stanza/operator/input/windows/input.go @@ -197,17 +197,10 @@ func (i *Input) readToEnd(ctx context.Context) { default: if count := i.read(ctx); count == 0 { if i.isRemote() { - i.Logger().Info("Stopping remote session", zap.String("server", i.remote.Server)) - if err := i.stopRemoteSession(); err != nil { - i.Logger().Error("Failed to stop remote session", zap.String("server", i.remote.Server), zap.Error(err)) - return - } - i.Logger().Info("Start remote session", zap.String("server", i.remote.Server)) if err := i.startRemoteSession(); err != nil { i.Logger().Error("Failed to re-establish remote session", zap.String("server", i.remote.Server), zap.Error(err)) return } - i.Logger().Info("Open") if err := i.subscription.Open(i.startAt, uintptr(i.remoteSessionHandle), i.channel, i.bookmark); err != nil { i.Logger().Error("Failed to re-open subscription for remote server", zap.String("server", i.remote.Server), zap.Error(err)) } @@ -223,6 +216,9 @@ 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() + i.subscription = NewRemoteSubscription(i.remote.Server) + i.Logger().Info("Reopening subscription") return 0 }