Fix pipelines.yml paths

This commit is contained in:
Alexandru-Victor Macocian
2025-10-30 17:29:14 +01:00
parent a8a402730b
commit b7cd8076c7
+31
View File
@@ -68,6 +68,36 @@ UpdateOutputConfig() {
fi
}
UpdatePipelinesConfig() {
local pipelines_file="${LOGSTASH_CONFIG_DIR}/pipelines.yml"
local temp_file=$(mktemp)
if [[ ! -f "$pipelines_file" ]]; then
LogError "Pipelines config file not found: $pipelines_file"
exit 1
fi
LogInformation "Updating path.config in pipelines.yml for $OS_TYPE"
# Update path.config based on OS
if [[ "$OS_TYPE" == "macos" ]]; then
sed 's|path\.config: "/etc/logstash/conf\.d/\*\.conf"|path.config: "/usr/local/etc/logstash/conf.d/*.conf"|' \
"$pipelines_file" > "$temp_file"
else
# Linux - keep as is
cp "$pipelines_file" "$temp_file"
fi
if grep -q "path.config:" "$temp_file"; then
mv "$temp_file" "$pipelines_file"
LogInformation "Updated pipelines.yml path.config for $OS_TYPE"
else
rm -f "$temp_file"
LogError "Failed to update pipelines.yml"
exit 1
fi
}
InstallLogstashConfigs() {
local installed_count=0
local failed_count=0
@@ -272,6 +302,7 @@ Main() {
CheckRoot
CheckLogstashInstalled
UpdateOutputConfig "$user" "$password" "$host"
UpdatePipelinesConfig
InstallLogstashConfigs
ValidateLogstashConfig
LogInformation "Logstash setup completed successfully!"