From 334b0b8ab6e7ddea73e263d8f13d6af040e71650 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Mon, 18 Mar 2024 11:17:47 +1100 Subject: [PATCH] improve logging --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 27677ed..12374f9 100644 --- a/main.go +++ b/main.go @@ -292,15 +292,15 @@ func main() { if hostFound { - // make sure that this event is within 15 minutes of the corresponding host failed event - unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -15)) - unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * 15)) + // make sure that this event is within 10 minutes of the corresponding host failed event + unreachableStartComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * -10)) + unreachableEndComparison := h.CreatedTime.In(location).Add(time.Duration(int64(time.Minute) * 10)) if haFailedTime.Before(unreachableEndComparison) && haFailedTime.After(unreachableStartComparison) { haUnreachableEvents = append(haUnreachableEvents, h) - log.Printf("Host %s unreachable HA status event at %s : '%s'\n", h.Host.Name, h.CreatedTime.In(location).Format(time.ANSIC), h.FullFormattedMessage) + log.Printf("Recording host %s unreachable HA status event at %s\n", h.Host.Name, h.CreatedTime.In(location).Format(time.ANSIC)) } else { - log.Printf("Host %s unreachable HA status event at %s was before %s or after %s\n", h.Host.Name, h.CreatedTime.In(location).Format(time.ANSIC), + log.Printf("Host %s HA failure time at %s was before %s or after %s\n", h.Host.Name, haFailedTime.Format(time.ANSIC), unreachableStartComparison, unreachableEndComparison) }