Fix filebeat script

This commit is contained in:
2025-07-03 00:04:55 +02:00
parent d1110f157c
commit 767f61c65c
+4 -4
View File
@@ -85,8 +85,8 @@ InstallFilebeatConfigs() {
fi
# Install modules.d configurations
LogInformation "Installing Filebeat modules from ${FILEBEAT_CONFIG_DIR}/modules"
if [[ -d "${FILEBEAT_CONFIG_DIR}/modules" ]]; then
LogInformation "Installing Filebeat modules from ${FILEBEAT_CONFIG_DIR}/modules.d"
if [[ -d "${FILEBEAT_CONFIG_DIR}/modules.d" ]]; then
while IFS= read -r -d '' module_file; do
local filename=$(basename "$module_file")
local target_file="${FILEBEAT_MODULES_D_DIR}/${filename}"
@@ -99,7 +99,7 @@ InstallFilebeatConfigs() {
LogError "Failed to install: $filename"
((failed_count++))
fi
done < <(find "${FILEBEAT_CONFIG_DIR}/modules" -name "*.yml" -type f -print0)
done < <(find "${FILEBEAT_CONFIG_DIR}/modules.d" -name "*.yml" -type f -print0)
else
LogWarning "modules directory not found in source"
fi
@@ -181,7 +181,7 @@ RemoveFilebeatConfigs() {
rm -f "$target_file"
((removed_count++))
fi
done < <(find "${FILEBEAT_CONFIG_DIR}/modules" -name "*.yml" -type f -print0 2>/dev/null)
done < <(find "${FILEBEAT_CONFIG_DIR}/modules.d" -name "*.yml" -type f -print0 2>/dev/null)
fi
if [[ $removed_count -gt 0 ]]; then