-
Notifications
You must be signed in to change notification settings - Fork 1
/
error-logs.yaml
34 lines (29 loc) · 1.17 KB
/
error-logs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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.notifications.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'] }}`"
}
extend:
title: Using errorLogs function to send error message to Slack
description: >-
This `fail` task of the workflow will always fail.
The error logs are captured using the `errorLogs()` function which is sent
as a Slack alert message.
The `errorLogs()` function retrieves a list of error logs from the failed task run.
This is useful when sending alerts on failure. When using this function e.g. in a
Slack alert message, you'll have the context about why the execution failed.
tags:
- Error
- Fail
ee: false
demo: false
meta_description: This workflow uses errorLogs function to retrive list of error logs.