fix: Prevent indexer-init logs from appearing twice in health check
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user