﻿---
title: Detection
description: Learn how Elastic nightshift learns your system from your logs, watches for unusual changes, and groups them into significant events that you can investigate.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection
products:
  - Elastic Cloud Serverless
  - Elastic Documentation
  - Elastic Observability
applies_to:
  - Serverless Observability projects: Preview
---

# Detection
Detection finds problems that your alerts miss, and you don't need to create rules to find them. Elastic nightshift learns which services and dependencies your logs describe, generates its own rules, and watches for unusual changes. When related changes show up across several services, it groups them into a single significant event that shows which services and databases are affected, giving you one problem to look at instead of multiple small alerts.
[Turn detection on](/elastic/docs-content/pull/9663/solutions/observability/nightshift/get-started#nightshift-get-started-detection) once and choose the data that it watches. After that, it runs in the background.
Open detection from the home page by selecting **Detections** or using the global search field. The **Signals** and **Topology** tabs on the **Detections** page are only available in [developer mode](/elastic/docs-content/pull/9663/solutions/observability/nightshift/settings#nightshift-settings-developer-mode).

## From your data to a significant event

```mermaid
flowchart LR
    A["Your data<br/>(sources)"] --> B["Learn<br/>(Knowledge Indicators)"]
    B --> C["Rules"]
    C --> D["Signals"]
    D --> E["Discovery"]
    E --> F["Significant event<br/>(an alert)"]
    F -.-> G["Investigate"]
```

1. **You choose the data.** A source is an ES|QL query that selects the logs to watch, such as all logs with `FROM logs*`.
2. **Elastic nightshift learns your system.** It samples each source and extracts Knowledge Indicators (KIs), facts such as the language a service is written in and the database it uses.
3. **It writes rules.** From the KIs, it generates ES|QL rules that look for failure patterns in your services, such as lock timeouts in a database. High-severity match query KIs become rules automatically, and you can promote others. Refer to [Where rules come from](/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/rules-and-signals#nightshift-detection-rules-origins).
4. **Rules produce signals.** Rules run on a schedule. When the rate at which a rule matches changes significantly, for example a sudden spike, detection records a signal.
5. **Discovery checks the signals.** Discovery reviews related signals together with your KIs and current data, and tests whether they point to a real, current problem.
6. **Elastic nightshift raises a significant event.** When discovery confirms a problem, or can't rule it out, it opens a significant event with a summary, a severity, and a confidence.
7. **You investigate.** Start an investigation from the event to find the likely cause, or let an automation start it for you.

For example, when a database starts to time out on locks, the rules for database lock timeouts, for statement timeouts in the service that uses it, and for slow requests to that service can all spike at once. Instead of three alerts, you get one significant event, with all three signals as its evidence.

## Terms


| Term                     | What it is                                                                                                                                          | Where you find it                                                           |
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| Source                   | An ES|QL query that selects the data that detection watches.                                                                                        | **Sources** page                                                            |
| Knowledge Indicator (KI) | A fact that Elastic nightshift extracted from a source, such as a service, a database, or a dependency. Some KIs are queries that can become rules. | **Knowledge** → **Knowledge Indicators**                                    |
| Entity                   | A service, database, or other component that Elastic nightshift learned from your KIs.                                                              | **Entities** list on the **Detections** page                                |
| Rule                     | An ES|QL query that runs on a schedule and counts the log lines that match one failure pattern.                                                     | **Rules** tab                                                               |
| Signal                   | A record that a rule's match rate changed significantly. Signals don't need any action from you.                                                    | **Signals** tab (developer mode), and the **Detections** list of each event |
| Significant event        | A problem that discovery confirmed from one or more signals, with a severity, a confidence, and a status.                                           | **Events** tab                                                              |

A significant event is an alert. You can route it to your team and act on it like any other alert, and an automation can investigate it. Refer to [Route significant events and investigate them automatically](/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/significant-events#nightshift-detection-events-route).

## Limitations

- **It starts only when you ask.** Detection doesn't run until someone with the [privileges to manage sources](/elastic/docs-content/pull/9663/solutions/observability/nightshift/privileges#nightshift-privileges-admin) selects the data to watch. Refer to [Manage what detection monitors](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/sources).
- **It's optimized for logs.** Detection works best with logs. Sources for metrics or traces work, but in Tech Preview, results are best with logs. Sources apply to detection only: investigations query your logs, metrics, and traces without one. Refer to [What a source is](/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/sources#nightshift-detection-sources-what).
- **It watches data that this project can reach with ES|QL.** That is your project and any project linked through cross-project search. Detection doesn't use connectors, so the External Elasticsearch connector only helps investigations. For what works with each deployment type, refer to [Reference architecture](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/reference-architecture).
- **It needs time to learn.** Expect the first KIs and rules within a few minutes, and the first signals 40 minutes to about 2.5 hours after you turn it on, while the rules warm up. After the warm-up, detection takes about 10 to 30 minutes to detect a change. Significant events appear only when something actually changes. Refer to [How long learning takes](/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/learning#nightshift-detection-learning-warmup).
- **It doesn't change your environment.** Detection reads your data and raises events. It doesn't investigate them unless you or an automation starts an investigation.
- **It can be wrong.** Each event shows its confidence and the signals behind it, so you can check why it was raised. Refer to [Check the evidence before you act](/elastic/docs-content/pull/9663/solutions/observability/nightshift/investigation#nightshift-investigations-accuracy).


## What it costs and how to control it

Detection uses model tokens to learn KIs and run discovery. Cost grows with the number of sources, the amount of data, and how often learning runs. To limit it, refer to [What uses tokens](/elastic/docs-content/pull/9663/solutions/observability/nightshift/cost-and-models#nightshift-cost-drivers). Rules also run as ES|QL queries against your data every few minutes. For the query load and storage, refer to the [Operator guide](/elastic/docs-content/pull/9663/solutions/observability/nightshift/significant-events/operator-guide#sig-events-op-impact).

## Work with detection

To work with detection, start from what you want to do:
- To turn on detection and choose the data it watches, refer to [Manage what detection monitors](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/sources).
- To understand what Elastic nightshift learned about your system, refer to [How detection learns your system](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/learning).
- To check the rules behind an event, or remove a noisy rule, refer to [Rules and signals](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/rules-and-signals).
- To review significant events and investigate them, refer to [Review significant events](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/detection/significant-events).


## Learn more

- [Detect problems your alerts miss](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/use-cases/detect-problems): Follow the end-to-end use case, from turning detection on to your first investigated event.
- [Operator guide](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/observability/nightshift/significant-events/operator-guide): Check system impact, cost drivers, and recovery procedures.