Manage what detection monitors
Tell Elastic nightshift which logs to learn from and watch for problems. Start with all your logs in one step, or narrow detection down to the services you care about most.
Each set of data that detection watches is a source. Detection is optimized for logs. Sources can also select metrics or traces, but in Tech Preview, results are best with logs. You choose sources when you turn detection on, and you can add, change, pause, or remove them at any time.
- An admin has enabled Elastic nightshift.
- You have the privileges to manage detection sources. Refer to Grant access.
- Your project has recent logs, or can reach them through cross-project search.
To turn on detection, follow the detection steps in Get started. To watch only some of your logs from the start, create a source first, then select it when you enable detection. All logs watches all your logs with the query FROM logs*.
Elastic nightshift starts to learn from each source right away. Refer to How long learning takes.
A source is an ES|QL query that selects rows of data, and nothing else. The query must:
- Start with
FROMorTS. - Contain only
WHEREcommands after that. Commands that change the rows, such asSTATS,EVAL, orKEEP, aren't allowed. - Select one kind of data. Elastic nightshift derives the kind of data, such as logs or metrics, from the index names. A query that mixes kinds is rejected. For example,
FROM logs-*, my-app-*is rejected becausemy-app-*isn't recognized as logs. A wildcard for everything, such as*, is also rejected.
Sources apply to detection only. Investigations don't need a source. They query all the logs, metrics, and traces that your connectors reach.
For example:
All your logs:
FROM logs*The services of one application:
FROM logs-* | WHERE service.name IN ("inventory-api", "web", "ticket-issuer")One environment:
FROM logs-* | WHERE deployment.environment == "production"
Each source is learned separately, and cost grows with the number of sources. Start with All logs. Add narrower sources when you want detection to focus on a part of your system.
Detection reads data from all projects linked through cross-project search, whatever project scope is configured for this space.
To create a source from the Detections page:
- At the top of the Detections page, select Sources, then select Create source.
- Enter a Title. Optionally, add a Description and Tags.
- In ES|QL query, write the query for the logs to watch. To have the query written for you, enter a
//comment that describes the data, then press Cmd + j. - Select Run query. Check the rows in Data preview.
- Keep Enabled on, so that Elastic nightshift starts to learn from the source right away.
- Select Create source.
The source appears in the list, and learning starts. On the Detections page before detection is on, the same form ends with Add source instead.
To open the list, select Sources at the top of the Detections page. Search by title, tag, or query.
The list has the following columns:
- Title, Query: The name of the source and its ES|QL query.
- Enabled: Whether detection learns from and watches this source.
- Events: How many results the source's rules produced in the last 24 hours.
- KI Queries, KI Features: How many query KIs and feature KIs Elastic nightshift extracted from the source. Refer to How detection learns your system.
- Status: A green check if the source works. A red X if Elastic nightshift hit an error. Hover over the X to read the error.
To work with a source:
- Change it. Select its title, change the fields in Edit source, and select Save. If you change the query, the source's KIs and rules no longer match it, so Elastic nightshift deletes them and learns the source again. Confirm with Save and reset knowledge.
- Learn from it again now. Select Onboard source in its row. To stop a run, select Stop source onboarding. For several sources, select them and then Generate. To run only one step, open the menu next to Generate and select Generate KI Features or Generate KI Queries.
- Look for significant events now. Select Find significant events to run discovery without waiting for the next scheduled run. To stop it, open the menu next to the button and select Cancel.
- Pause it. Turn off Enabled.
- Delete it. Select the delete icon in its row, then Delete source. This deletes the source, its KIs, and its rules. Significant events that detection already found are kept, and the daily stale event cleanup marks them Inactive.
Runs that you start yourself don't count toward the daily run limits. If you delete your last source, detection stops and the Detections page shows only earlier results.
To pause all detection instead of one source, go to Settings → Detections and select Pause detection engine. Refer to Settings and limits.
- How detection learns your system: Find out what Elastic nightshift extracts from your sources and how long it takes.
- Review significant events: Review what detection finds and investigate it.
- Settings and limits: Set run limits and continuous learning, or pause detection.