Change filebeat output test for single node test

This commit is contained in:
vcerenu 2025-05-20 10:15:24 -03:00
parent 6861e077b6
commit 3cdebd4275
No known key found for this signature in database
GPG Key ID: 4D7B159107F1244A

View File

@ -1,9 +1,20 @@
filebeatout=$(docker exec single-node_wazuh.manager_1 sh -c 'filebeat test output') COMMAND_TO_EXECUTE="filebeat test output"
filebeatstatus=$(echo "${filebeatout}" | grep -c OK)
MASTER_CONTAINERS=$(docker ps --format '{{.Names}}' | grep -E '*manager*')
if [ -z "$CONTAINER_NAMES" ]; then
echo "No se encontraron contenedores con 'master' en su nombre."
else
for MASTER_CONTAINERS in $MASTER_CONTAINERS; do
FILEBEAT_OUTPUT=$(docker exec "$MASTER_CONTAINERS" $COMMAND_TO_EXECUTE)
FILEBEAT_STATUS=$(echo "${FILEBEAT_OUTPUT}" | grep -c OK)
if [[ filebeatstatus -eq 7 ]]; then if [[ filebeatstatus -eq 7 ]]; then
echo "No errors in filebeat" echo "No errors in filebeat"
echo "${FILEBEAT_OUTPUT}"
else else
echo "Errors in filebeat" echo "Errors in filebeat"
echo "${filebeatout}" echo "${FILEBEAT_OUTPUT}"
exit 1 exit 1
fi fi
done
fi