Improve pipeline bootstrap error logs (#16495)

This PR adds the cause errors details on the pipeline converge state error logs
This commit is contained in:
Edmo Vamerlatti Costa 2024-10-03 11:08:42 +02:00 committed by GitHub
parent 60670087cb
commit e84fb458ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -395,7 +395,13 @@ class LogStash::Agent
)
end
rescue SystemExit, Exception => e
logger.error("Failed to execute action", :action => action, :exception => e.class.name, :message => e.message, :backtrace => e.backtrace)
error_details = { :action => action, :exception => e.class.name, :message => e.message, :backtrace => e.backtrace }
cause = e.cause
if cause && e != cause
error_details[:cause] = { :exception => cause.class, :message => cause.message }
error_details[:cause][:backtrace] = cause.backtrace if cause.backtrace
end
logger.error('Failed to execute action', error_details)
converge_result.add(action, LogStash::ConvergeResult::FailedAction.from_exception(e))
end
end