From 776a54fdc79860e7f3fe668448d63c8bc1174398 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Sun, 10 Dec 2023 14:29:15 -0800 Subject: [PATCH] fixed update payload Signed-off-by: Amardeepsingh Siglani --- public/store/CorrelationsStore.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/public/store/CorrelationsStore.ts b/public/store/CorrelationsStore.ts index 16de1a233..0bd8ebd4e 100644 --- a/public/store/CorrelationsStore.ts +++ b/public/store/CorrelationsStore.ts @@ -107,14 +107,26 @@ export class CorrelationsStore implements ICorrelationsStore { { name: correlationRule.name, time_window: correlationRule.time_window, - correlate: correlationRule.queries?.map((query) => ({ - index: query.index, - category: query.logType, - query: query.conditions + correlate: correlationRule.queries?.map((query) => { + const queryString = query.conditions .map((condition) => `${condition.name}:${condition.value}`) - .join(' AND '), - field: query.field, - })), + .join(' AND '); + + const correlationInput: any = { + index: query.index, + category: query.logType, + }; + + if (queryString) { + correlationInput['query'] = queryString; + } + + if (query.field) { + correlationInput['field'] = query.field; + } + + return correlationInput; + }), } );