Skip to content

Commit 0d49d92

Browse files
Improve pipeline bootstrap error logs (#16495) (#16503)
This PR adds the cause errors details on the pipeline converge state error logs (cherry picked from commit e84fb45) Co-authored-by: Edmo Vamerlatti Costa <[email protected]>
1 parent d085559 commit 0d49d92

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

logstash-core/lib/logstash/agent.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,13 @@ def converge_state(pipeline_actions)
395395
)
396396
end
397397
rescue SystemExit, Exception => e
398-
logger.error("Failed to execute action", :action => action, :exception => e.class.name, :message => e.message, :backtrace => e.backtrace)
398+
error_details = { :action => action, :exception => e.class.name, :message => e.message, :backtrace => e.backtrace }
399+
cause = e.cause
400+
if cause && e != cause
401+
error_details[:cause] = { :exception => cause.class, :message => cause.message }
402+
error_details[:cause][:backtrace] = cause.backtrace if cause.backtrace
403+
end
404+
logger.error('Failed to execute action', error_details)
399405
converge_result.add(action, LogStash::ConvergeResult::FailedAction.from_exception(e))
400406
end
401407
end

0 commit comments

Comments
 (0)