Automatically investigate your alerts

Elastic nightshift can automatically investigate your alerts using automations. An automation starts an investigation when an alert matches the conditions you set up, and posts the findings to Slack, giving the on-call engineer a head start on fixing the problem.

Before setting up automations, run some investigations to familiarize yourself with the process and the results. Refer to Investigate your alerts.

Your checkout alert rules have the tag checkout. You want every Critical alert from them investigated, with the findings posted to #checkout-oncall.

The process looks something like this:

  1. A rule tagged checkout fires an alert with severity Critical.
  2. The automation checks that the alert matches and that no daily limit is reached.
  3. Elastic nightshift starts an investigation and posts a message in #checkout-oncall.
  4. When the investigation finishes, Elastic nightshift updates that message with the impact, the conclusion, and the hypotheses.

For this process to work, you need to first create the automation that fires under this scenario:

  1. On the Elastic nightshift home page, select Automations → Create automation.
  2. Enter a Name, for example Investigate critical checkout alerts. Optionally, add a Description and Tags.
  3. Under Trigger, select Add trigger → Alert triggered. The trigger reads as a sentence: When an alert from Any rule from any source changes to Active with severity Any severity.
  4. Select Any rule, select one of the following:
    • Select a tag, such as checkout. Every rule with that tag is selected, including rules that you add later.
    • Select individual rules by name.
  5. Optionally, select any source to limit where alerts come from: Classic rules, Universal rules, Significant events, or External sources.
  6. Select Any severity and select the alert severity that you want to trigger an investigation. Only the severities that the selected rules support are available. Elastic nightshift checks the severity once, when the alert becomes active; later changes don't start an investigation.
  7. Set the Daily trigger limit. Refer to Daily trigger limit.
  8. Optionally, in Additional Instructions, tell Elastic nightshift about these services. Refer to Point Elastic nightshift to your runbooks and code.
  9. Under Notifications, select Add notification → Post in Slack. Search for and select the Slack channel you want to send investigation results to. If no channels are listed, select Connect channels in Settings.
  10. Select Save and enable. To save an automation, but leave it turned off, select Save.

The automation now appears on the Automations page with Enabled on. To pause it, turn off Enabled.

Deployment-wide limits apply on top of the automation's own limit, and the lowest limit wins. Refer to How a start is checked.

Each investigation that the automation starts reads its Additional Instructions, up to 5,000 characters. Include information like:

  • Where things live: the GitHub repositories for the services and their deployment configuration.
  • Runbooks: links to the runbooks for these alerts, and the checks your team does first.
  • Ownership: who owns each service and its dependencies.
  • What's normal: known noisy periods, planned jobs, or dependencies that often cause trouble.

For the checkout alerts in the example scenario, you might add something like:

Checkout runs on the web service and calls inventory-api, which uses the
Postgres encore database. Code: github.com/example/web and
github.com/example/inventory-api. Helm charts are in deploy/helm.
Runbook: https://wiki.example.com/runbooks/checkout.
The payments team owns web; the inventory team owns inventory-api.
A reconcile-batch job runs every hour on the hour and can hold row locks.
		

On the Automations page, select the automation, then Run history. A skipped run shows why. Refer to Check what an automation did.

To start from a schedule or a Slack message instead, refer to Triggers. For alerts that another tool posts in Slack, refer to Investigate alerts from your other tools.

  • Start narrow. Begin with a few rules that fire a few times a day and matter to someone. Widen it when the results are useful.
  • Read the first results. Check the hypothesis tree of the first investigations, and improve the instructions where Elastic nightshift looked in the wrong place.
  • Expect one investigation per alert. A new alert from the same rule starts its own investigation, and automations can't group repeat firings into one. Refer to Each problem has one investigation.
  • Edit the automation, not its workflow. Changes apply from the next trigger. Refer to The workflow behind an automation.