Source
yaml
id: error-logs
namespace: company.team
tasks:
- id: fail
type: io.kestra.plugin.core.execution.Fail
errorMessage: Something went wrong, make sure to fix it asap!
errors:
- id: slack
type: io.kestra.plugin.slack.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"text": "Failure alert for flow `{{ flow.namespace }}.{{ flow.id }}` with ID `{{ execution.id }}`. Here is a bit more context about why the execution failed: `{{ errorLogs()[0]['message'] }}`"
}
About this blueprint
Core Infrastructure
This workflow demonstrates how to capture and forward detailed error
context from failed Kestra task executions using the errorLogs() function
and send enriched failure notifications to Slack.
It shows how to:
- Force a workflow failure to demonstrate error handling and alerting patterns.
- Retrieve structured error logs from a failed task run using the
errorLogs()function. - Extract meaningful failure messages to provide actionable context in alerts.
- Send enriched Slack notifications containing both execution metadata and the underlying error message.
- Improve observability and reduce troubleshooting time by surfacing precise failure reasons.
This pattern is ideal for monitoring, debugging, and incident response workflows where understanding why a failure occurred is as important as knowing that it failed.
More Related Blueprints