Skip to content

Commit

Permalink
Fail the flow the when detectot type is missing in the log types index (
Browse files Browse the repository at this point in the history
opensearch-project#845) (opensearch-project#909)

Signed-off-by: Megha Goyal <[email protected]>
(cherry picked from commit 8d19912)

Co-authored-by: Megha Goyal <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and goyamegh authored Mar 13, 2024
1 parent efade2c commit aa4706d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ public void onFailure(Exception e) {
}

public void insertOrphanFindings(String detectorType, Finding finding, float timestampFeature, Map<String, CustomLogType> 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<String, Object> tags = logTypes.get(detectorType).getTags();
String correlationId = tags.get("correlation_id").toString();

Expand Down

0 comments on commit aa4706d

Please sign in to comment.