From 79e8f42771b9de1ea09e3ac4eeebabdcc839fec9 Mon Sep 17 00:00:00 2001 From: Daniel de Carvalho Gomes Date: Wed, 15 May 2024 22:26:04 -0700 Subject: [PATCH] Add instanceId to health check log --- agent/health/healthcheck.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/health/healthcheck.go b/agent/health/healthcheck.go index ab81d5dfb..9e586a30f 100644 --- a/agent/health/healthcheck.go +++ b/agent/health/healthcheck.go @@ -123,7 +123,14 @@ func (h *HealthCheck) updateHealth() { } }() - log.Infof("%s reporting agent health.", name) + log.Infof("%s %s reporting agent health.", func() string { + instanceID, err := h.context.Identity().ShortInstanceID() + if err != nil { + log.Errorf("Failed to get instance ID: %v", err) + return "" + } + return instanceID + }(), name) appConfig := h.context.AppConfig() var isEC2, isECS, isOnPrem bool