Skip to content

Commit 8765e4e

Browse files
Merge pull request #2909 from MicrosoftDocs/maccruz-queryopt
Optimizing queries
2 parents 01c1a42 + 708827c commit 8765e4e

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

defender-xdr/advanced-hunting-best-practices.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@ ms.custom:
1818
- cx-ti
1919
- cx-ah
2020
ms.topic: best-practice
21-
ms.date: 04/22/2024
21+
appliesto:
22+
- Microsoft Defender XDR
23+
- Microsoft Sentinel in the Microsoft Defender portal
24+
ms.date: 02/24/2025
2225
---
2326

2427
# Advanced hunting query best practices
2528

2629
[!INCLUDE [Microsoft Defender XDR rebranding](../includes/microsoft-defender.md)]
2730

2831

29-
**Applies to:**
30-
- Microsoft Defender XDR
32+
Get results faster and avoid timeouts while running complex queries by optimizing your queries. For guidance on improving query performance:
33+
- [General optimization tips](#understand-cpu-resource-quotas) - in this article
34+
- [Optimize the `join` operator](#optimize-the-join-operator) - in this article
35+
- [Optimize the `summarize` operator](#optimize-the-summarize-operator) - in this article
36+
- [Query scenarios](#query-scenarios) - in this article
37+
- [Kusto query best practices](/azure/kusto/query/best-practices) - includes several scenarios for making your query more efficient
38+
- [Optimize log queries in Azure Monitor](/azure/azure-monitor/logs/query-optimization#early-filtering-of-records-prior-to-using-high-cpu-functions) - contains additional guidance for query optimization
39+
- [Optimizing KQL queries](https://www.youtube.com/watch?v=ceYvRuPp5D8) (video) - most common ways to improve your query
3140

32-
Apply these recommendations to get results faster and avoid timeouts while running complex queries. For more guidance on improving query performance, read [Kusto query best practices](/azure/kusto/query/best-practices).
3341

3442
## Understand CPU resource quotas
3543
Depending on its size, each tenant has access to a set amount of CPU resources allocated for running advanced hunting queries. For detailed information about various usage parameters, [read about advanced hunting quotas and usage parameters](advanced-hunting-limits.md).
@@ -40,7 +48,6 @@ After running your query, you can see the execution time and its resource usage
4048

4149
Customers who run multiple queries regularly should track consumption and apply the optimization guidance in this article to minimize disruption resulting from exceeding quotas or usage parameters.
4250

43-
Watch [Optimizing KQL queries](https://www.youtube.com/watch?v=ceYvRuPp5D8) to see some of the most common ways to improve your queries.
4451

4552
## General optimization tips
4653

defender-xdr/custom-detection-rules.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ms.collection:
1818
ms.custom:
1919
- cx-ti
2020
- cx-ah
21+
appliesto:
22+
- Microsoft Defender XDR
23+
- Microsoft Sentinel in the Microsoft Defender portal
2124
ms.topic: how-to
2225
ms.date: 02/10/2025
2326
---
@@ -26,8 +29,7 @@ ms.date: 02/10/2025
2629

2730
[!INCLUDE [Microsoft Defender XDR rebranding](../includes/microsoft-defender.md)]
2831

29-
**Applies to:**
30-
- Microsoft Defender XDR
32+
3133

3234
Custom detection rules are rules you can design and tweak using [advanced hunting](advanced-hunting-overview.md) queries. These rules let you proactively monitor various events and system states, including suspected breach activity and misconfigured endpoints. You can set them to run at regular intervals, generating alerts and taking response actions whenever there are matches.
3335

@@ -265,7 +267,7 @@ Only data from devices in the scope will be queried. Also, actions are taken onl
265267
After reviewing the rule, select **Create** to save it. The custom detection rule immediately runs. It runs again based on configured frequency to check for matches, generate alerts, and take response actions.
266268

267269
> [!IMPORTANT]
268-
> Custom detections should be regularly reviewed for efficiency and effectiveness. To make sure you're creating detections that trigger true alerts, take time to review your existing custom detections by following the steps in [Manage existing custom detection rules](#manage-existing-custom-detection-rules).
270+
> Custom detections should be regularly reviewed for efficiency and effectiveness. For guidance on how to optimize your queries, follow the **[Advanced hunting query best practices](advanced-hunting-best-practices.md)**. To make sure you're creating detections that trigger true alerts, take time to review your existing custom detections by following the steps in **[Manage existing custom detection rules](#manage-existing-custom-detection-rules)**.
269271
>
270272
> You maintain control over the broadness or specificity of your custom detections so any false alerts generated by custom detections might indicate a need to modify certain parameters of the rules.
271273

defender-xdr/custom-detections-overview.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ms.custom:
1818
- cx-ti
1919
- cx-ah
2020
ms.topic: overview
21+
appliesto:
22+
- Microsoft Defender XDR
23+
- Microsoft Sentinel in the Microsoft Defender portal
2124
ms.date: 06/27/2024
2225
---
2326

@@ -26,10 +29,8 @@ ms.date: 06/27/2024
2629
[!INCLUDE [Microsoft Defender XDR rebranding](../includes/microsoft-defender.md)]
2730

2831

29-
**Applies to:**
30-
- Microsoft Defender XDR
3132

32-
With custom detections, you can proactively monitor for and respond to various events and system states, including suspected breach activity and misconfigured endpoints. This is made possible by customizable detection rules that automatically trigger alerts and response actions.
33+
With custom detections, you can proactively monitor for and respond to various events and system states, including suspected breach activity and misconfigured endpoints. Custom detections are customizable detection rules that automatically trigger alerts and response actions.
3334

3435
Custom detections work with [advanced hunting](advanced-hunting-overview.md), which provides a powerful, flexible query language that covers a broad set of event and system information from your network. You can set them to run at regular intervals, generating alerts and taking response actions whenever there are matches.
3536

@@ -38,10 +39,12 @@ Custom detections provide:
3839
- Alerts for rule-based detections built from advanced hunting queries
3940
- Automatic response actions
4041

42+
Optimizing your queries in custom detection rules is important in avoiding time-outs and ensuring efficiency. There are several resources available that provide guidance on optimizing your queries in [Advanced hunting query best practices](advanced-hunting-best-practices.md).
43+
4144
## See also
4245

4346
- [Create and manage custom detection rules](custom-detection-rules.md)
44-
- [Advanced hunting overview](advanced-hunting-overview.md)
47+
- [Advanced hunting query best practices](advanced-hunting-best-practices.md)
4548
- [Migrate advanced hunting queries from Microsoft Defender for Endpoint](advanced-hunting-migrate-from-mde.md)
4649
- [Microsoft Graph security API for custom detections](/graph/api/resources/security-api-overview?view=graph-rest-beta&preserve-view=true#custom-detections)
4750

0 commit comments

Comments
 (0)