New to Kestra?
Use blueprints to kickstart your first workflows.
Attach log context to incidents automatically. A Kestra webhook snapshots the last 15 minutes of Loki logs for a service and summarizes it in Slack.
The first ten minutes of an incident are usually spent assembling context that already exists. This blueprint attaches that context automatically: the incident tooling calls a Kestra webhook, io.kestra.plugin.grafana.loki.QueryRange captures the last 15 minutes of the affected service's logs, and Slack gets a summary with the line count while the full snapshot stays on the execution. By the time responders join the channel, the window in which things went wrong is already preserved, immune to log retention and later noise.
incident_webhook trigger (io.kestra.plugin.core.trigger.Webhook) exposes a URL your incident tooling calls at declaration time; the service input defaults to checkout and can be overridden per call.snapshot_logs (io.kestra.plugin.grafana.loki.QueryRange) runs {app="<service>"} with since: 15m, fetching up to 2000 lines from the window leading into the incident.{{ outputs.snapshot_logs.logs }} on the execution, a frozen record of the pre-incident window.post_summary posts the scalar line count and service name to Slack, pointing responders at the execution for the full set.errors block warns the channel explicitly when the snapshot fails, so nobody waits on context that is not coming.The query is trivial; the guarantees are not. Kestra gives the snapshot a stable webhook endpoint, an input contract for the affected service, retries against a briefly unreachable Loki, a permanent execution holding the captured lines, and an explicit failure signal in the incident channel. Extending the same flow to capture metrics, recent deploys, or config diffs is adding tasks, not building a new service.
app (adjust the selector to your labels).authToken and tenantId (X-Scope-OrgID).LOKI_URL: Loki base URL, e.g. http://loki.monitoring:3100.SLACK_WEBHOOK_URL: Slack incoming webhook URL.LOKI_URL and SLACK_WEBHOOK_URL secrets to your Kestra namespace.change-me-strong-webhook-key with a strong random value.since: 60m for slow-burn incidents, raising limit to match.|= "ERROR" and report both totals in the summary.