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

View File

@@ -1,9 +1,20 @@
filebeatout=$(docker exec single-node_wazuh.manager_1 sh -c 'filebeat test output')
filebeatstatus=$(echo "${filebeatout}" | grep -c OK)
if [[ filebeatstatus -eq 7 ]]; then
echo "No errors in filebeat"
COMMAND_TO_EXECUTE="filebeat test output"
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
echo "No errors in filebeat"
echo "${FILEBEAT_OUTPUT}"
else
echo "Errors in filebeat"
echo "${filebeatout}"
echo "${FILEBEAT_OUTPUT}"
exit 1
fi
done
fi