Skip to content

Commit 8d19912

Browse files
authored
Fail the flow the when detectot type is missing in the log types index (opensearch-project#845)
Signed-off-by: Megha Goyal <goyamegh@amazon.com>
1 parent 0ef8543 commit 8d19912

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/org/opensearch/securityanalytics/correlation/VectorEmbeddingsEngine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ public void onFailure(Exception e) {
229229
}
230230

231231
public void insertOrphanFindings(String detectorType, Finding finding, float timestampFeature, Map<String, CustomLogType> logTypes) {
232+
if (logTypes.get(detectorType) == null) {
233+
log.error("LogTypes Index is missing the detector type {}", detectorType);
234+
correlateFindingAction.onFailures(new OpenSearchStatusException("LogTypes Index is missing the detector type", RestStatus.INTERNAL_SERVER_ERROR));
235+
}
236+
232237
Map<String, Object> tags = logTypes.get(detectorType).getTags();
233238
String correlationId = tags.get("correlation_id").toString();
234239

0 commit comments

Comments
 (0)