From 90455740713e8a0e0ec20857e7675a373ab778f3 Mon Sep 17 00:00:00 2001 From: Gui-Gos <97973228+Gui-Gos@users.noreply.github.com> Date: Sun, 4 Jan 2026 18:56:03 +0100 Subject: [PATCH] fix: Prevent indexer-init logs from appearing twice in health check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add special handling in log display loop to exclude indexer-init when matching indexer container. Without this fix, grep matches both wazuh-indexer and wazuh-indexer-init when service=indexer, causing indexer-init logs to display twice. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- apps/wazuh-runtipi/data/debug/wazuh-health-check.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/wazuh-runtipi/data/debug/wazuh-health-check.sh b/apps/wazuh-runtipi/data/debug/wazuh-health-check.sh index 8f25022..433456d 100644 --- a/apps/wazuh-runtipi/data/debug/wazuh-health-check.sh +++ b/apps/wazuh-runtipi/data/debug/wazuh-health-check.sh @@ -160,7 +160,12 @@ echo "" # Display logs for all Wazuh containers for service in certs indexer indexer-init manager dashboard; do - container_name=$(docker ps -a --format '{{.Names}}' | grep -E "${WAZUH_PREFIX}.*${service}" | head -1) + # Special handling for 'indexer' to avoid matching 'indexer-init' + if [ "$service" = "indexer" ]; then + container_name=$(docker ps -a --format '{{.Names}}' | grep -E "${WAZUH_PREFIX}.*${service}" | grep -v "init" | head -1) + else + container_name=$(docker ps -a --format '{{.Names}}' | grep -E "${WAZUH_PREFIX}.*${service}" | head -1) + fi if [ -n "$container_name" ]; then status=$(docker inspect --format='{{.State.Status}}' "$container_name" 2>/dev/null) health=$(docker inspect --format='{{.State.Health.Status}}' "$container_name" 2>/dev/null || echo "no healthcheck")