From 76550ffa0cffbd426b0771b25c8eba7f4382f594 Mon Sep 17 00:00:00 2001 From: Megha Goyal <56077967+goyamegh@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:54:41 -0800 Subject: [PATCH] Fail the flow the when detectot type is missing in the log types index (#845) Signed-off-by: Megha Goyal (cherry picked from commit 8d19912fe1515a515b3d6a4c3f46064ab8047bb0) --- .../correlation/VectorEmbeddingsEngine.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/opensearch/securityanalytics/correlation/VectorEmbeddingsEngine.java b/src/main/java/org/opensearch/securityanalytics/correlation/VectorEmbeddingsEngine.java index f0f433d5e..b74dc13cf 100644 --- a/src/main/java/org/opensearch/securityanalytics/correlation/VectorEmbeddingsEngine.java +++ b/src/main/java/org/opensearch/securityanalytics/correlation/VectorEmbeddingsEngine.java @@ -226,6 +226,11 @@ public void onFailure(Exception e) { } public void insertOrphanFindings(String detectorType, Finding finding, float timestampFeature, Map logTypes) { + if (logTypes.get(detectorType) == null) { + log.error("LogTypes Index is missing the detector type {}", detectorType); + correlateFindingAction.onFailures(new OpenSearchStatusException("LogTypes Index is missing the detector type", RestStatus.INTERNAL_SERVER_ERROR)); + } + Map tags = logTypes.get(detectorType).getTags(); String correlationId = tags.get("correlation_id").toString();