Update-Test
This commit is contained in:
15
main.go
15
main.go
@@ -349,6 +349,8 @@ func runChannelWatcher(ctx context.Context, hostname string, cfg ChannelConfig,
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("[%s] EvtNext lieferte %d Events", cfg.Name, len(events))
|
||||
|
||||
for _, h := range events {
|
||||
payload, err := buildPayloadFromEventHandle(hostname, cfg.Name, h)
|
||||
_ = evtClose(h)
|
||||
@@ -358,10 +360,20 @@ func runChannelWatcher(ctx context.Context, hostname string, cfg ChannelConfig,
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("[%s] Event empfangen: EventID=%d Source=%s Time=%s",
|
||||
cfg.Name,
|
||||
payload.EventID,
|
||||
payload.Source,
|
||||
payload.Time.Format(time.RFC3339),
|
||||
)
|
||||
|
||||
if !cfg.IDs[payload.EventID] {
|
||||
log.Printf("[%s] Event weggefiltert: EventID=%d", cfg.Name, payload.EventID)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("[%s] Event wird gesendet: EventID=%d", cfg.Name, payload.EventID)
|
||||
|
||||
select {
|
||||
case out <- payload:
|
||||
case <-ctx.Done():
|
||||
@@ -399,7 +411,7 @@ func runSender(
|
||||
if len(batch) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Flush: sende %d Events an %s", len(batch), backendURL)
|
||||
ok, err := sendBatch(client, backendURL, state, enrollmentKey, batch)
|
||||
if err != nil {
|
||||
log.Printf("sendBatch Fehler: %v", err)
|
||||
@@ -546,6 +558,7 @@ func sendBatch(client *http.Client, backendURL string, state *AgentState, enroll
|
||||
return false, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
log.Printf("Backend Response: HTTP %d", resp.StatusCode)
|
||||
|
||||
if resp.StatusCode == http.StatusAccepted {
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user