diff --git a/orchestrator/setup-logstash.sh b/orchestrator/setup-logstash.sh index bcb0b03..9472398 100755 --- a/orchestrator/setup-logstash.sh +++ b/orchestrator/setup-logstash.sh @@ -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!"