Skip to content

Commit

Permalink
enabled findings in bucket level monitor creation (#131)
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
(cherry picked from commit 1b36aa1)
  • Loading branch information
eirsep authored and github-actions[bot] committed Nov 9, 2022
1 parent e11c00e commit dccee6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ private IndexMonitorRequest createBucketLevelMonitorRequest(
detector.getAlertsHistoryIndex(),
detector.getAlertsHistoryIndexPattern(),
DetectorMonitorConfig.getRuleIndexMappingsByType(detector.getDetectorType()),
false), PLUGIN_OWNER_FIELD);
true), PLUGIN_OWNER_FIELD);

return new IndexMonitorRequest(monitorId, SequenceNumbers.UNASSIGNED_SEQ_NO, SequenceNumbers.UNASSIGNED_PRIMARY_TERM, refreshPolicy, restMethod, monitor, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ public void testCreatingADetectorWithAggregationRules() throws IOException {

Response executeResponse = executeAlertingMonitor(bucketLevelMonitorId, Collections.emptyMap());
Map<String, Object> executeResults = entityAsMap(executeResponse);
// TODO - check findings
// verify bucket level monitor findings
Map<String, String> params = new HashMap<>();
params.put("detector_id", createdRuleId);
Response getFindingsResponse = makeRequest(client(), "GET", SecurityAnalyticsPlugin.FINDINGS_BASE_URI + "/_search", params, null);
Map<String, Object> getFindingsBody = entityAsMap(getFindingsResponse);
assertNotNull(getFindingsBody);
Assert.assertEquals(1, getFindingsBody.get("total_findings"));
}
public void testUpdateADetector() throws IOException {
String index = createTestIndex(randomIndex(), windowsIndexMapping());
Expand Down

0 comments on commit dccee6f

Please sign in to comment.