mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-05-12 13:27:23 +00:00
Merge pull request #5066 from joinimran/patch-15
Added query as example
This commit is contained in:
commit
8c271fc337
@ -25,16 +25,26 @@ ms.topic: article
|
|||||||
|
|
||||||
Custom detection rules built from [Advanced hunting](overview-hunting.md) queries let you proactively monitor various events and system states, including suspected breach activity and misconfigured machines. The queries run every 24 hours, generating alerts and taking response actions whenever there are matches.
|
Custom detection rules built from [Advanced hunting](overview-hunting.md) queries let you proactively monitor various events and system states, including suspected breach activity and misconfigured machines. The queries run every 24 hours, generating alerts and taking response actions whenever there are matches.
|
||||||
|
|
||||||
>[!NOTE]
|
> [!NOTE]
|
||||||
>To create and manage custom detections, [your role](user-roles.md#create-roles-and-assign-the-role-to-an-azure-active-directory-group) needs to have the **manage security settings** permission.
|
> To create and manage custom detections, [your role](user-roles.md#create-roles-and-assign-the-role-to-an-azure-active-directory-group) needs to have the **manage security settings** permission.
|
||||||
|
|
||||||
## Create a custom detection rule
|
## Create a custom detection rule
|
||||||
### 1. Prepare the query.
|
### 1. Prepare the query.
|
||||||
|
|
||||||
In Microsoft Defender Security Center, go to **Advanced hunting** and select an existing query or create a new query. When using an new query, run the query to identify errors and understand possible results.
|
In Microsoft Defender Security Center, go to **Advanced hunting** and select an existing query or create a new query. When using an new query, run the query to identify errors and understand possible results.
|
||||||
|
|
||||||
>[!NOTE]
|
> [!NOTE]
|
||||||
>To use a query for a custom detection rule, the query must return the `EventTime`, `MachineId`, and `ReportId` columns in the results. Queries that don’t use the `project` operator to customize results usually return these common columns.
|
> To use a query for a custom detection rule, the query must return the `EventTime`, `MachineId`, and `ReportId` columns in the results. Queries that don’t use the `project` operator to customize results usually return these common columns.
|
||||||
|
|
||||||
|
The sample query below counts the number of unique machines (`MachineId`) with antivirus detections and uses this count to find only the machines with more than five detections. To return the latest `EventTime` and the corresponding `ReportId`, it uses the `summarize` operator with the `arg_max` function.
|
||||||
|
|
||||||
|
```
|
||||||
|
MiscEvents
|
||||||
|
| where EventTime > ago(7d)
|
||||||
|
| where ActionType == "AntivirusDetection"
|
||||||
|
| summarize (EventTime, ReportId)=arg_max(EventTime, ReportId), count() by MachineId
|
||||||
|
| where count_ > 5
|
||||||
|
```
|
||||||
|
|
||||||
### 2. Create new rule and provide alert details.
|
### 2. Create new rule and provide alert details.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user