Skip to content

Commit 470cf36

Browse files
committed
feat: split device import into 4 steps, using hash() to bucket device IDS
1 parent a7c2a42 commit 470cf36

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

plugins/MicrosoftDefender/v1/dataStreams/listDevices.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
"expandInnerObjects": true,
1414
"endpointPath": "runHuntingQuery",
1515
"postBody": {
16-
"Query": "DeviceInfo | where isnotempty(DeviceName) | project Timestamp, DeviceId, DeviceName | summarize arg_max(Timestamp, *) by DeviceId"
16+
"Query": "DeviceInfo | where isnotempty(DeviceName) and hash(DeviceId, 4) == {{shardIndex}} | project Timestamp, DeviceId, DeviceName | summarize arg_max(Timestamp, *) by DeviceId"
1717
},
1818
"pathToData": "results",
1919
"getArgs": [],
2020
"headers": []
2121
},
22+
"ui": [
23+
{ "name": "shardIndex", "label": "Shard Index", "type": "text", "defaultValue": "0" }
24+
],
2225
"providesPluginDiagnostics": true,
2326
"manualConfigApply": true,
2427
"timeframes": false,

plugins/MicrosoftDefender/v1/indexDefinitions/default.json

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
11
{
22
"steps": [
33
{
4-
"name": "Import Devices",
4+
"name": "Import Devices (1)",
55
"dataStream": {
6-
"name": "listDevices"
6+
"name": "listDevices",
7+
"config": { "shardIndex": "0" }
8+
},
9+
"timeframe": "none",
10+
"objectMapping": {
11+
"id": "DeviceId",
12+
"name": "DeviceName",
13+
"type": {
14+
"value": "Device"
15+
}
16+
}
17+
},
18+
{
19+
"name": "Import Devices (2)",
20+
"dataStream": {
21+
"name": "listDevices",
22+
"config": { "shardIndex": "1" }
23+
},
24+
"timeframe": "none",
25+
"objectMapping": {
26+
"id": "DeviceId",
27+
"name": "DeviceName",
28+
"type": {
29+
"value": "Device"
30+
}
31+
}
32+
},
33+
{
34+
"name": "Import Devices (3)",
35+
"dataStream": {
36+
"name": "listDevices",
37+
"config": { "shardIndex": "2" }
38+
},
39+
"timeframe": "none",
40+
"objectMapping": {
41+
"id": "DeviceId",
42+
"name": "DeviceName",
43+
"type": {
44+
"value": "Device"
45+
}
46+
}
47+
},
48+
{
49+
"name": "Import Devices (4)",
50+
"dataStream": {
51+
"name": "listDevices",
52+
"config": { "shardIndex": "3" }
753
},
854
"timeframe": "none",
955
"objectMapping": {

0 commit comments

Comments
 (0)